please convert this small html code to php (echo, print ..)

Discussion in 'PHP' started by himtuna, Apr 27, 2009.

  1. #1
    Hi, I want to print this html code into php I don't know php at all. Tried echo and print statements but was getting errors.


    <div class="content">
    <div class="menu">
      <ul class="menu">
    	<li class="leaf first no-dhtml">
    		<a href="<? php print url('node/' . $my_id  . '/announcement', array('absolute' =>  TRUE)); ?>">Announcement</a></li>
    	<li class="leaf no-dhtml">
    		<a href="<? php print url('node/' . $my_id  . '/assignment', array('absolute' =>  TRUE)); ?>">Assignment</a></li>
       </ul>
    </div>
    </div>
    HTML:

    please note that there is php function called url() whose output I want to display.
    <? php print url('node/' . $my_id  . '/assignment', array('absolute' =>  TRUE)); ?>
    PHP:

     
    himtuna, Apr 27, 2009 IP
  2. pixmania

    pixmania Peon

    Messages:
    229
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    source http://www.yellowpipe.com/yis/tools/HTML_converter/

    As long as your php print statements work this should work fine in a php file.

    <?php
    echo "<div class=\"content\">\n"; 
    echo "<div class=\"menu\">\n"; 
    echo "  <ul class=\"menu\">\n"; 
    echo "    <li class=\"leaf first no-dhtml\">\n"; 
    echo "        <a href=\"<?php print url('node/' . $my_id  . '/announcement', array('absolute' =>  TRUE)); ?>\">Announcement</a></li>\n"; 
    echo "    <li class=\"leaf no-dhtml\">\n"; 
    echo "        <a href=\"<?php print url('node/' . $my_id  . '/assignment', array('absolute' =>  TRUE)); ?>\">Assignment</a></li>\n"; 
    echo "   </ul>\n"; 
    echo "</div>\n"; 
    echo "</div>\n";
    ?>
    PHP:
     
    pixmania, Apr 27, 2009 IP
  3. himtuna

    himtuna Member

    Messages:
    225
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #3
    Thank you very much for the link, I'll try it and let you know the results.
    but i shal keep this line separate

    echo " <a href=\"<?php print url('node/' . $my_id . '/announcement', array('absolute' => TRUE)); ?>\">Announcement</a></li>\n";
     
    himtuna, Apr 27, 2009 IP