-
1. Re: Can someone tell me how to use jquery to replace the "No one logged in" message generated from {modu
Chad - BCGurus.com Apr 29, 2013 3:15 PM (in response to Doug McLachlan)Hello Doug McLachlan,
Depending how you have your HTML, you can do this with jQuery or CSS.
In the CSS method you would just add that is logged in module to the class of the div: <div class="user-{module_isloggedin}"></div> - Then in your CSS display none on the user-0 class.
The jQuery method is similar, you're just checking if the isloggedin module is a one or zero, then using jQuery to hide or show.
To just replace the text with nothing using jQuery would be something like this: http://jsfiddle.net/chaddidthis/4TQeV/
Hope this helps,
Chad Smith - BC Gurus
-
2. Re: Can someone tell me how to use jquery to replace the "No one logged in" message generated from {modu
Doug McLachlan Apr 29, 2013 8:40 PM (in response to Chad - BCGurus.com)Thanks Chad, much appreciated... I'll give it a go
-
3. Re: Can someone tell me how to use jquery to replace the "No one logged in" message generated from {modu
Simon Darby Jul 1, 2013 5:40 PM (in response to Chad - BCGurus.com)Thanks Chad. The CSS things is both obvious (now that you mention it) and brilliant.
So here's my example for swapping out text, rather than making it visable/invisable, for anyone trying the same thing in the Online Shop module for small_product.html.
HTML:
<h4><span class="public-price-{module_isloggedin}">Note: </h4>
CSS:
.public-price-1:after {
content:"Special member only price";
}
.public-price-0:after {
content:"Sign-in for special member only price - Membership is free";
}
Note: For :after to work in IE8, a <!DOCTYPE> must be declared in your HTML doc. e.g. <!DOCTYPE html> for the head tag.
-
4. Re: Can someone tell me how to use jquery to replace the "No one logged in" message generated from {modu
Chad - BCGurus.com Jul 2, 2013 8:00 AM (in response to Simon Darby)Simon,
That too is brilliant! I always forget about the many pseudo classes that are available to us. They can truly make your life easier.
Thanks,
Chad Smith
-
5. Re: Can someone tell me how to use jquery to replace the "No one logged in" message generated from {modu
thetrickster888 Jul 2, 2013 1:12 PM (in response to Simon Darby)Great solution! Should note though that this won't work in IE less than 8 but those browsers are losing their market share pretty fast. If you need to support less than IE8 you should use a javascript solution.
Also, you forgot to close your <span> in your <h4>. I only mention it because its a matter of time before someone tries to replicate your solution and runs into that problem.
Nice work, though! I too need to start using pseudo classes more since IE8 does support them. For years I was avoiding them entirely because of lack of support and I need to keep reminding myself to start using them more.
-
6. Re: Can someone tell me how to use jquery to replace the "No one logged in" message generated from {modu
Simon Darby Jul 2, 2013 4:17 PM (in response to thetrickster888)Oh yes, thanks. I better correct that...
So here's my example for swapping out text, rather than making it visable/invisable, for anyone trying the same thing in the Online Shop module for small_product.html.
HTML:
<h4><span class="public-price-{module_isloggedin}">Note: </span></h4>
CSS:
.public-price-1:after {
content:"Special member only price";
}
.public-price-0:after {
content:"Sign-in for special member only price - Membership is free";
}
-
7. Re: Can someone tell me how to use jquery to replace the "No one logged in" message generated from {modu
ChrisDigitalTao Sep 11, 2014 5:37 PM (in response to Simon Darby)Thanks for this discovery, I've been pulling my hair out to get a logged-in / not-logged-in dynamic driving some basic content
Is it true I would need to adopt a javascript method to include a link to my sign in page in the 0 content " " ?
thanks so much
-
8. Re: Can someone tell me how to use jquery to replace the "No one logged in" message generated from {modu
Keihamm Sep 17, 2014 9:08 PM (in response to ChrisDigitalTao)Let me add that you also need to add a css rule for "user-" as well. Sometimes the system does not display the "0"
.user-,.user-0{display:none}



