473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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 1539
Lumpy
69
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
great thanks man!
works great.
Nov 6 '07 #3
Lumpy
69
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
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...
1
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...
4
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
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
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...
5
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
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. ...
3
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...
2
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...
7
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.