Current location: Hot Scripts Forums » Programming Languages » PHP » Assigning images according to page type(s)


Assigning images according to page type(s)

Reply
  #1 (permalink)  
Old 12-14-06, 02:37 PM
deltatango5 deltatango5 is offline
Newbie Coder
 
Join Date: Dec 2003
Location: VA
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Question Assigning images according to page type(s)

I'm in the midst of converting a site from ASP to PHP and my PHP skills are a bit subpar to say the least ... What I'm trying to do is to assign various pages ($sPAGE_TYPE = "gen"; ) for instance with appropriate images to the respective page types ... there are approximately 14 different cases or page types that require different images to use. Some of these page types may as well have multiple images to rotate within the same page type ... MEANING, there may be a page type that is called "fred" for instance and within the 9 pages that are type "fred" they would require as many as 6 images to change upon a page visit.

Below is what I have so far but have hit a wall, is there anyone who could provide assistance on helping out? Your assistance is greatly appreciated!!
Code:
<%if $sPAGE_TYPE="seo" then%>
<%if second(now)>=0 and second(now)<20 then%>
<img src="<?php print $g_servername; ?>images/b_seo2.jpg" alt="" height="136" width="328" border="0">
<%elseif second(now)>=20 and second(now)<40 then%>
<img src="<?php print $g_servername; ?>images/b_seo3.jpg" alt="" height="136" width="328" border="0">
<% else%>
<img src="<?php print $g_servername; ?>images/b_seo4.jpg" alt="" height="136" width="328" border="0">
<%end if%>

<%elseif $sPAGE_TYPE = "ppc" then %>
<%if second(now)>=0 and second(now)<30 then%>
<img src="<?php print $g_servername; ?>images/b_ppc1.jpg" alt="" height="136" width="328" border="0">
<% else%>
<img src="<?php print $g_servername; ?>images/b_ppc2.jpg" alt="" height="136" width="328" border="0">
<%end if%>
<%elseif $sPAGE_TYPE = "mobile" then %>
<img src="<?php print $g_servername; ?>images/b_ppc5.jpg" alt="" height="136" width="328" border="0">
<%elseif $sPAGE_TYPE = "shopping" then %>
<img src="<?php print $g_servername; ?>images/b_ppc3.jpg" alt="" height="136" width="328" border="0">
<%elseif $sPAGE_TYPE = "landing" then %>
<img src="<?php print $g_servername; ?>images/b_ppc4.jpg" alt="" height="136" width="328" border="0">
<%elseif $sPAGE_TYPE = "casestudy" then %>
<img src="<?php print $g_servername; ?>images/b_ppc1.jpg" alt="" height="136" width="328" border="0">
<%elseif $sPAGE_TYPE = "shg" then %>
<img src="<?php print $g_servername; ?>images/b_cs1a.jpg" alt="" height="136" width="328" border="0">
<%elseif $sPAGE_TYPE = "dsi" then %>
<img src="<?php print $g_servername; ?>images/b_cs2a.jpg" alt="" height="136" width="328" border="0">
<%elseif $sPAGE_TYPE = "aaa" then %>
<img src="<?php print $g_servername; ?>images/b_cs3a.jpg" alt="" height="136" width="328" border="0">
<%elseif $sPAGE_TYPE = "hr" then %>
<img src="<?php print $g_servername; ?>images/b_cs4a.jpg" alt="" height="136" width="328" border="0">
<%elseif $sPAGE_TYPE = "tmg" then %>
<img src="<?php print $g_servername; ?>images/b_cs5a.jpg" alt="" height="136" width="328" border="0">
<%elseif $sPAGE_TYPE = "ws" then %>
<img src="<?php print $g_servername; ?>images/b_cs6a.jpg" alt="" height="136" width="328" border="0">
<%elseif $sPAGE_TYPE = "prseo" then %>
<img src="<?php print $g_servername; ?>images/b_seo5.jpg" alt="" height="136" width="328" border="0">
<%elseif $sPAGE_TYPE = "analytics" then %>
<img src="<?php print $g_servername; ?>images/b_gen3.jpg" alt="" height="136" width="328" border="0">
<%elseif $sPAGE_TYPE = "gen" then %>

<%if second(now)>=0 and second(now)<8 then%>
<img src="<?php print $g_servername; ?>images/b_ppc1.jpg" alt="" height="136" width="328" border="0">
<% elseif second(now)>=8 and second(now)<16 then%>
<img src="<?php print $g_servername; ?>images/b_ppc2.jpg" alt="" height="136" width="328" border="0">
<%elseif second(now)>=16 and second(now)<24 then%>
<img src="<?php print $g_servername; ?>images/b_seo2.jpg" alt="" height="136" width="328" border="0">
<%elseif second(now)>=24 and second(now)<32 then%><img src="<?php print $g_servername; ?>images/b_seo3.jpg" alt="" height="136" width="328" border="0">
<% elseif second(now)>=32 and second(now)<40 then%><img src="<?php print $g_servername; ?>images/b_seo4.jpg" alt="" height="136" width="328" border="0">
<% elseif second(now)>=40 and second(now)<48 then%><img src="<?php print $g_servername; ?>images/b_ppc5.jpg" alt="" height="136" width="328" border="0">
<%elseif second(now)>=48 and second(now)<56 then%><img src="<?php print $g_servername; ?>images/b_ppc3.jpg" alt="" height="136" width="328" border="0">
<%else%><img src="<?php print $g_servername; ?>images/b_ppc4.jpg" alt="" height="136" width="328" border="0">
<%end if%>
<%else%><img src="<?php print $g_servername; ?>images/b_1theme.jpg" alt="" height="136" width="328" border="0">
<%end if%>

Last edited by Nico; 12-14-06 at 02:39 PM. Reason: Please use [code] wrappers when posting code.
Reply With Quote
  #2 (permalink)  
Old 12-15-06, 06:55 AM
Shaffer Shaffer is offline
Wannabe Coder
 
Join Date: Sep 2006
Location: Israel
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Well, the ASP and PHP syntaxes aren't so different after-all.
I just need to know what second(now) means, and all the stuff like that and I'll help you convert most of the stuff you need me to.



Shaffer.
__________________
Hello from Israel!
Reply With Quote
  #3 (permalink)  
Old 12-15-06, 07:39 AM
deltatango5 deltatango5 is offline
Newbie Coder
 
Join Date: Dec 2003
Location: VA
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Shaffer, Thanks so much for you assistance ... The "second(now)" is assigned to "rotate" similar or like images withing multiple pages having the same page type: $sPAGE_TYPE = "gen" and $sPAGE_TYPE="seo" I believe are the only page types or page classifications requiring randomization of multiple images upon visit. Does this make sense? Shaffer, basically I need is to ensure that those pages or page types in question (reference code) still have ability to have a random image "assigned" ...

You're more than welcome to IM to AOL, YAHOO: deltatango5 ... MSN: deltatango5@hotmail.com.

I hope this made it a bit more understandable ... thanks for any assistance Shaffer!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[turnkey] Lyrics site - $149 (LEGAL) rightinpoint General Advertisements 0 10-22-06 04:33 AM
Resize all images on page Bazzio JavaScript 7 12-24-05 05:11 AM
Classified Ads skipper23 Perl 3 11-22-05 02:22 AM
page browsing problem mivec PHP 3 04-17-04 03:43 AM
Classified Ads skipper23 Perl 2 12-30-03 03:43 AM


All times are GMT -5. The time now is 05:50 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.