Different slider on each page. IF function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
timmydeleu
Forum Newbie
Posts: 3
Joined: Fri Feb 04, 2011 4:01 pm

Different slider on each page. IF function

Post by timmydeleu »

I'm trying to figure out how to make this work. I have an image slider in the header of my website. The slider has a piece of code that looks like this.

<?php if (function_exists('premium_slider_center')){ premium_slider_center(4); }; ?>

What I want to do is when someone click on a page they get a different slider. I can call a different slider simply by changing the slider number, for instance
<?php if (function_exists('premium_slider_center')){ premium_slider_center(3); }; ?>

I am new to php but I tried a few things anyway.

if(is_page('6')){echo '<?php if (function_exists('premium_slider_center')){ premium_slider_center(4); }; ?>';}
if(is_page('79')){echo '<?php if (function_exists('premium_slider_center')){ premium_slider_center(3); }; ?>';}


I also tried
<?php if (is_page('6'))(function_exists('premium_slider_center')){ premium_slider_center(4); }; ?>';}
<?php if (is_page('79'))(function_exists('premium_slider_center')){ premium_slider_center(3); }; ?>';}

But I'm obviously doing something wrong and I don't really understand what I'm doing just yet. I'll keep reading but I hope someone can push me in the right direction.

Timmy
timmydeleu
Forum Newbie
Posts: 3
Joined: Fri Feb 04, 2011 4:01 pm

Re: Different slider on each page. IF function

Post by timmydeleu »

I just found something that almost works

<?php if (is_page('6') AND function_exists('premium_slider_center')) { premium_slider_center(4); }; ?>
<?php if (is_page('79') AND function_exists('premium_slider_center')) { premium_slider_center(3); }; ?>

http://www.kohkoodguide.com/facilities/

The problem is it splits the sliders up on the second page.
timmydeleu
Forum Newbie
Posts: 3
Joined: Fri Feb 04, 2011 4:01 pm

Re: Different slider on each page. IF function

Post by timmydeleu »

got it, thois was the correct code <?php if (is_page('6') AND function_exists('premium_slider_center')) { premium_slider_center(4); }; ?>
<?php if (is_page('79') AND function_exists('premium_slider_center')) { premium_slider_center(5); }; ?>
Post Reply