Show/Hide content based on url string ?
Posted September 13th 2012, 5:19pm
When the url string is ?mode=hide, the content will be hidden. But when there is no url string, the content will be shown.
<!-- IF SHOWHIDE --><div id="test">Test</div><!-- ENDIF -->

Thanks for your advices.
φ
Posts: 209
Joined: September 10th 2011, 11:00pm
Location: SC, USA
Likes Given: 8
Likes Received: 8
Show/Hide content based on url string ?
Posted September 13th 2012, 5:33pm
First, I would not use mode for the query variable since it's used in quite a few files already. Let's say the variable is zero. :)

You would add the following code above the template variable declaration in includes/functions.php:

$zero = request_var('zero', '');
$showhide = ($zero == '') ? false : true;

And in the template variable declaration, you would add:

'SHOWHIDE' => $showhide,

Just make sure this is NOT the last template variable in the array.

Now, whenever you add ?zero=hide or &zero=hide to a URL, the SHOWHIDE variable will be FALSE.
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Show/Hide content based on url string ?
Posted September 13th 2012, 6:06pm
Thank you pretty much :)
φ
Posts: 209
Joined: September 10th 2011, 11:00pm
Location: SC, USA
Likes Given: 8
Likes Received: 8

Who is online

Users browsing this forum: No registered users and 0 guests