473,800 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP echo function within an img tag, whichis within another echo tag! hehe

6 New Member
hi all.
sounds like a complicated one, but i am using e107, so alot of the php code has been written out, but im looking into just putting a straight:
Expand|Select|Wrap|Line Numbers
  1. <?php echo(rand(1,5)); ?>
into this code (i put a "ENTER HERE CODE" for where it must go:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $HEADER = "
  3. <!-- CONTENT: Holds all site content except for the footer.  This is what causes the footer to stick to the bottom -->
  4. <div id='content'>
  5.  
  6.     <!-- HEADER: Holds title, subtitle and header images -->
  7.     <div id='header'>
  8.  
  9.  
  10.  
  11.  
  12.         <img src='".THEME."images/header_left(CODE ENTER HERE!!!).jpg' alt='left slice' class='left' />
  13.         <img src='".THEME."images/header_right.jpg' alt='right slice' class='right' />
  14.  
  15.     </div>
  16.  
  17.     <!-- MAIN MENU: Top horizontal menu of the site.  Use class='here' to turn the current page tab on -->
  18.  
  19.  
  20.     <!-- PAGE CONTENT BEGINS: This is where you would define the columns (number, width and alignment) -->
  21.     <div id='page'>
  22.  
  23.  
  24.         <!-- 25 percent width column, aligned to the left -->
  25.         <div class='width25 floatLeft leftColumn'>
  26.             {SETSTYLE=top_left_menu}
  27.             {MENU=1}
  28.             {SETSTYLE=bottom_left_menu}
  29.             {MENU=2}
  30.         </div>
  31.             {SETSTYLE=default}
  32.         <!-- 75 percent width column, aligned to the right -->
  33.         <div class='width75 floatRight'>
  34. ";
  35. ?>
Nov 6 '07 #1
3 1557
Lumpy
69 New Member
I would just set that rand expression to a variable and put the variable into the echo statement...

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $somevar = rand(1,5);
  3.  
  4. $HEADER = "...
  5.  
  6. <img src='".THEME."images/header_left$somevar.jpg' alt='left slice' class='left' />
  7.  
  8. ...
  9. ?>
  10.  
Nov 6 '07 #2
brucehere
6 New Member
great thanks man!
works great.
Nov 6 '07 #3
Lumpy
69 New Member
great thanks man!
works great.
Your Welcome, glad I could help! :D
Nov 6 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2179
by: lawrence | last post by:
Right now, over at www.monkeyclaus.org, the following script is getting to the 9th run through and dying after the line: echo "..."; You'll admit that is a strange place to die. I've hit refresh several times and it keeps happening. When I view page source, the last thing that shows up is the "...". The date doesn't print, nor does the closing the div tag.
1
2912
by: Chris Dean | last post by:
Hi I'm useing the php NUKE CMS and am designing a theme for it. this basically consists of the the main html structure of the page being produced line by line from php echo commands I have a javascript menu system I want to use which is held in an external ..js file so I try to echo out the relevent <script></script> startements to load up this file however it's not showing up on the page - however the static html version of the
4
6906
by: Leila | last post by:
Hi, I am having a problem retrieving the html tags from my XML document when it's being loaded into a DOM object. For example, my xml contains the following: <my:InsideView> .. ..
4
9082
by: Michael G | last post by:
Some of the online docs say that you can use echo <<<END all sorts of text and statements... END; but if the following produces a parse error at line 14 which is the closing
4
3764
by: Kieran Simkin | last post by:
Hi All, Just writing a quick function to remove HTML tags from a string (array of chars) and I'd like your comments on my code - anything you'd do differently or any mistakes etc. I'm still kinda new to C, so I'm not 100% confident using pointers yet. Anyway, the algorithm works like this: The loop steps over the string character by character with two pointers, I have a toggle variable that basically indicates whether the 's' pointer...
5
4644
by: mike | last post by:
If I have a document like: <script> function mike_test() {alert('hi');} </script> <iframe src="blank.html" id="my_iframe1"> </iframe> and in blank.html I have:
26
8126
by: johkar | last post by:
I need to cancel the link and execute a function onclick of all the links within the span tag which has a class of "container" assigned. There will be only one span tag with this class applied. I know you can get a specific tag using document.getElementsByTagName('span'), but I am unsure how to get the one with the class="container". I know there is a getAttribute method, just need a pointer or two to put it all together. Once I know...
3
2961
by: Water Cooler v2 | last post by:
Questions: 1. Can there be more than a single script block in a given HEAD tag? 2. Can there be more than a single script block in a given BODY tag? To test, I tried the following code. None of the script gets executed. Can someone please give me a direction as to what I may be missing? Thanks.
2
1158
by: Anish Chapagain | last post by:
Hi, I have Structure in C, program and the structure is being used with various function inside C coding but am getting undefined referenced to global method and few of them too uses the sturct module. my problem goes like this, ex.h ----------- #define NIL 0 /* Indicates ptr is nil */ #define NO_CODER 0 /* Means do not use an arithmetic
7
4206
by: jeddiki | last post by:
Hi, I am using a function called htmlwrap() which states that it does NOT add a "<br>" to the 70 character line so that it forces a line wrap. ( the script safely wraps long words without destroying html tags which wordwrap has a tendency of doing! )) What I want to do is add that line break so that it DOES force a line wrap - but I am not sure where to insert it in the function
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10276
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9090
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.