Go Back   Profit Blogging Forum > Community Forum > General Blogging Topics

General Blogging Topics Talk everything about blogs & blogging

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 14-02-08
carlosamigos carlosamigos is offline
Fresh Meat
 
Join Date: Feb 2008
Posts: 2
Default How do I create a variable on one page and use it on another?

How to I create/set a variable on the header.php page and call it on sidebar.php?

eg.
<!-- Header.php page -->
<? // Set Random Variable
if ( is_home() ) {
$myRandomVariable = 1;
}
else {
$myRandomVariable = rand(3,5);
}
?>

<!-- Header.php page-->
<div id="headerImage_<?php echo $myRandomVariable; ?>"></div>

<!-- Sidebar.php page -->
<div id="sidebarImage_<?php echo $myRandomVariable; ?>"></div>

Thanks

Carl
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +9. The time now is 10:31 AM.


LinkBacks Enabled by vBSEO 3.0.0 RC4

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28