I want to hide content if I’m in a filter/tag param. How would I do this?
So for example
/blog
<!-- Only visible for main flow of blog -->
<div>Some Content</div>
<div>Notes List</div>
/blog/tag:somecontent
<div>Notes List</div>
I want to hide content if I’m in a filter/tag param. How would I do this?
So for example
/blog
<!-- Only visible for main flow of blog -->
<div>Some Content</div>
<div>Notes List</div>
/blog/tag:somecontent
<div>Notes List</div>
<?php
if (param('tag') === null) {
// do something when no param set
} else {
// do something when param set
}
Hi,
i haven’t tested it but i would do it like this way.
<!-- Only visible for main flow of blog -->
<? if(param('tag') === null) : ?>
<div>Some Content</div>
<? endif; ?>
<div>Notes List</div>
You are missing the word php
<?php if (param('tag') === null): ?>
<?php endif; ?>
Follow on from this - how do I get the current value of the param?
For example if /tag:somecontent
How do I get the value ‘somecontent’
if ($tag = param('tag')) {
echo $tag;
}