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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • brucehere
    New Member
    • Nov 2007
    • 6

    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:[code=php]
    <?php echo(rand(1,5)) ; ?>[/code]

    into this code (i put a "ENTER HERE CODE" for where it must go:
    [code=php]
    <?php
    $HEADER = "
    <!-- CONTENT: Holds all site content except for the footer. This is what causes the footer to stick to the bottom -->
    <div id='content'>

    <!-- HEADER: Holds title, subtitle and header images -->
    <div id='header'>




    <img src='".THEME."i mages/header_left(CODE ENTER HERE!!!).jpg' alt='left slice' class='left' />
    <img src='".THEME."i mages/header_right.jp g' alt='right slice' class='right' />

    </div>

    <!-- MAIN MENU: Top horizontal menu of the site. Use class='here' to turn the current page tab on -->


    <!-- PAGE CONTENT BEGINS: This is where you would define the columns (number, width and alignment) -->
    <div id='page'>


    <!-- 25 percent width column, aligned to the left -->
    <div class='width25 floatLeft leftColumn'>
    {SETSTYLE=top_l eft_menu}
    {MENU=1}
    {SETSTYLE=botto m_left_menu}
    {MENU=2}
    </div>
    {SETSTYLE=defau lt}
    <!-- 75 percent width column, aligned to the right -->
    <div class='width75 floatRight'>
    ";
    ?>[/code]
    Last edited by pbmods; Nov 6 '07, 07:22 PM. Reason: Added CODE tags.
  • Lumpy
    New Member
    • Oct 2007
    • 69

    #2
    I would just set that rand expression to a variable and put the variable into the echo statement...

    [CODE=php]
    <?php
    $somevar = rand(1,5);

    $HEADER = "...

    <img src='".THEME."i mages/header_left$somevar.jpg' alt='left slice' class='left' />

    ...
    ?>
    [/CODE]
    Last edited by Lumpy; Nov 6 '07, 06:35 PM. Reason: forgot the closing code tag

    Comment

    • brucehere
      New Member
      • Nov 2007
      • 6

      #3
      great thanks man!
      works great.

      Comment

      • Lumpy
        New Member
        • Oct 2007
        • 69

        #4
        Originally posted by brucehere
        great thanks man!
        works great.
        Your Welcome, glad I could help! :D

        Comment

        Working...