Jump to content

New to PHP and need help formatting pages.


ov10mech

Recommended Posts

Hello,

 

I am fairly new to PHP and was hoping you guys could get me started.  I am an IT guy with an server/network infrastructure background and HTML experience.  However, PHP is new to me.  I have some programming knowledge such as how variables are defined and such.  I am setting up OSCommerce and have everything installed.  I want to start adding content to my main page and not sure how to handle the formatting.  For example - the opening text on the page is defined by the variable MAIN_TEXT in one file and another file ECHOs that line out.  I can figure out how to change simple things like the text, but I want to get a bit more fancier and start adding images and possible flash content.  With HTML I am used to just typing away in an HTML editor and WYSIWYG type interface.  In this example below.. I want a bunch of images and different formatted text after it echo’s the TEXT_MAIN.  If someone could point me to some reading on this subject (or examples) it would be greatly appreciated. I cant just paste in HTML code, can I ? 

 

 

          <td class="main"><?php echo TEXT_MAIN; ?></td>

          </tr>

          <tr>

            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

          </tr>

          <tr>

            <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

          </tr>

<?php

    include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);

?>

        </table></td>

      </tr>

    </table></td>

<?php

  }

?>

<!-- body_text_eof //-->

    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

    </table></td>

  </tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Your question is not quite clear, once you have echo the TEXT_MAIN you have a closing php tag "?>" and are therefore back to HTML, to add images simply use the HTML img tag... if you need help with this just google HTML tutorials "tizag.com" and the w3c site a good start for the basics....

Thanks.. So are you saying I can do all my work in an HTML editor (let's say font page ) and just paste the HTML code in?  Maybe I am over thinking this?   

 

Your question is not quite clear, once you have echo the TEXT_MAIN you have a closing php tag "?>" and are therefore back to HTML, to add images simply use the HTML img tag... if you need help with this just google HTML tutorials "tizag.com" and the w3c site a good start for the basics....

Ok I was able to paste in some simple HTML after the PHP tag and it worked fine.  I use a HTML editor to see what it's going to look like then paste in into the PHP file. 

 

What I cant figure out is how to preview the PHP page with the HTML code inside.  If I go to the preview pane with MS Expression Web it just shows blank. Is this a program that will allow me to view  a WYSIWYG like a pure HTML page?  I would like to be able to see the formatting as I design and not have to view it on the web server. 

To view PHP code it needs to be processed by a server. If you just want to test out pages i'd reccomend XAMPP as this is what i've used, and i'm a begginer. It allows PHP and MYSQL to run from your own machine. You simply start up XAMPP and then you can execute PHP code.

Here for more: http://www.apachefriends.org/en/xampp.html

 

The good thing about PHP is that the code within the <?php and ?> get's parsed as php, everything outside of this will get parsed as normal HTML.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.