Posts: 6
Threads: 1
Joined: Jun 2011
hello,
I'm more or less new to GS (tried it some times before) and I have a question if it's possible to make it so that a <div> in a template only shows up in the FE when it has some content given.
In a CMS that I use atm it's done with php
Thanks for helping!
Hans
Posts: 210
Threads: 15
Joined: Feb 2013
try to do it with a simple if
PHP Code:
<?php
$content = 'your content or something what You want to show';
if ($content != ''){
echo '<div>'. $content . '</div>';
}
?>
Posts: 6
Threads: 1
Joined: Jun 2011
Thanks XXDEX
I'll give it a try.
(2014-09-01, 18:15:26)xxdex Wrote: try to do it with a simple if
PHP Code:
<?php
$content = 'your content or something what You want to show';
if ($content != ''){
echo '<div>'. $content . '</div>';
}
?>
Posts: 3,491
Threads: 106
Joined: Mar 2010
I suggest you use a different name for that variable, e.g. $mycontent instead of $content, if you're going to use it in your template. Otherwise there could be some conflict with GS as it uses a $content variable.
Posts: 6
Threads: 1
Joined: Jun 2011
Thanks Carlos
As I'm new to GS I have to dig bit deeper in the script but I'll try ;-)
Hans
(2014-09-01, 23:16:26)Carlos Wrote: I suggest you use a different name for that variable, e.g. $mycontent instead of $content, if you're going to use it in your template. Otherwise there could be some conflict with GS as it uses a $content variable.