• I wonder if somebody can help me with this php syntax
    I am new to php and I was trying to use Angsumans adrotator in my header. It works fine when I use it like this:

    <div id=\\"banner\\">
    <?php echo getad('bannerhome');?>
    </div>

    But I want the adrotator be dependent of wich category your viewing, so I made this code:

    <div id=\\"banner\\">
    <?php if (is_home ()) {
        echo getad('bannerhome');
    /*for non specific category*/ } elseif (is_category ()) {
     	echo getad('bannerhome');
    /*agenda cultural*/ } elseif (is_category ('2')) {
    	echo getad('bannercultural');
    /*noticias*/ } elseif (is_category ('3')) {
    	echo getad('bannernoticias');
    /*reportaje*/ } elseif (is_category ('4')) {
    	echo getad('bannernoticias');
    /*libros*/ } elseif (is_category ('5')) {
    	echo getad('bannernoticias');
    }
    ?>
     </div>

    Anybody knows where I went wrong?

The topic ‘Conditional tags in header’ is closed to new replies.