Author Topic: New to PHP and need help formatting pages.  (Read 276 times)

0 Members and 1 Guest are viewing this topic.

Offline ov10mechTopic starter

  • Irregular
  • Posts: 3
    • View Profile
New to PHP and need help formatting pages.
« on: July 01, 2009, 10:51:03 AM »
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'); ?>

Offline flyhoney

  • Devotee
  • Posts: 845
  • Gender: Male
    • View Profile
    • blag
Re: New to PHP and need help formatting pages.
« Reply #1 on: July 01, 2009, 11:18:03 AM »
Use the code tags to format your code.
"The enemy's gate is down." - Ender
error_reporting(E_ALL);          // place these two lines at the top of 
ini_set('display_errors'1);    // the script you are debugging

Offline Bendude14

  • Enthusiast
  • Posts: 411
  • Gender: Male
  • Live for Today
    • View Profile
    • Mandurah Web Designs
Re: New to PHP and need help formatting pages.
« Reply #2 on: July 01, 2009, 11:19:06 AM »
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....

Offline ov10mechTopic starter

  • Irregular
  • Posts: 3
    • View Profile
Re: New to PHP and need help formatting pages.
« Reply #3 on: July 01, 2009, 02:01:07 PM »
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....

Offline ov10mechTopic starter

  • Irregular
  • Posts: 3
    • View Profile
Re: New to PHP and need help formatting pages.
« Reply #4 on: July 01, 2009, 05:16:43 PM »
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. 

Offline JJ2K

  • Enthusiast
  • Posts: 75
    • View Profile
Re: New to PHP and need help formatting pages.
« Reply #5 on: July 01, 2009, 05:39:09 PM »
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.