Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 04:50:26 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155555 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: PHP Conditional Snippet  (Read 486 times)
drphunk

Offline Offline

Posts: 6


« on: February 12, 2008, 08:18:35 AM »

Could really appreciate some help on this...

Developing a site with a sliding javascript-based accordion menu which is at http://www.toppeople.com.au/pages/home.php.

Of the 4 panels that slide around, you can specify the one you want open at page launch by giving the appropriate DIV an additional class of VISIBLE.

I need some help in creating the correct PHP snippet that will work something like this (this is just my logic):

if PAGE_ID is 23, 24, 25, 26 (etc, or perhaps a range i.e. 23-45),
then OUTPUT 'VISIBLE'

This way it can automatically assign the VISIBLE class to the correct div to have the correct navigation panel open when any particular page opens.

I've had a look through the functions.php file and found a few that almost seem right, but not quite all the way. Does anyone have any idea how I can achieve this??
Logged
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #1 on: February 12, 2008, 12:50:27 PM »

Something like:

Code:
<?php
if (PAGE_ID ==23 || PAGE_ID==24 ||  PAGE_ID==25)
 { 
 
# This gives true if page_id is 23, 24 or 25
 
echo '<DIV class="content aboutTopPeople visible">';
 echo 
'<DIV class="content findTopPeople"';

 }
else 
 {
 
# If it is NOT 23,24 or 25
 
echo '<DIV class="content aboutTopPeople">';
 echo 
'<DIV class="content findTopPeople visible">';
 }
?>


should do the trick I think
The rest of the html lines need to be echoed

Have fun,
John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
drphunk

Offline Offline

Posts: 6


« Reply #2 on: February 12, 2008, 11:08:51 PM »

Thank you! That's exactly what I was after Cheesy I'm planning on leaning some proper PHP skills soon but this is a big help in the meantime Cheesy
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!