Using the $key variable

drskitzo - April 26, 2009 - 22:04
Project:Custom Page
Version:6.x-1.6
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I am trying to have different banners on each page.

in page.tpl.php i was trying this code, Am i on the wrong path or is there a completely diff way I should be doing this?

<?php
if($key == "page2") {
?>
Page2
<?php
} else {
?>
Other page
<?php
}
?>

Thanks in advance

#1

drskitzo - April 27, 2009 - 16:31
Assigned to:drskitzo» Anonymous

#2

irakli - April 29, 2009 - 11:27
Status:active» fixed

Not sure if this has anything to do with CustomPage per se (I'd guess - no), but as a general comment you check the URL parts by looking checking them with arg([index]) function, not with a $key variable. That variable does not seem to be defined in your code.

Hope this helps.

Irakli

#3

drskitzo - April 29, 2009 - 17:57

can you be kind enough to give me an example of how I'd use the arg([index]) function for my purposes? :)

Is there a way I can get the $key defined in my code? Is there a file I need to include or whatnot?

Thanks in advance! :)

#4

System Message - May 13, 2009 - 18:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.