6 Replies - 651 Views - Last Post: 21 March 2012 - 08:12 AM Rate Topic: -----

#1 don57  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 56
  • Joined: 15-March 12

PHP code not being formatted by CSS

Posted 20 March 2012 - 05:35 PM

I am learning php and expermenting by nesting sections in a webpage. I used CSS to format a 3 column page and to control the text-indent for the paragraph in the div. When I use


<?php

echo "<p>$PAGE_ID</p>"

?>




the text appears a the starting left edge of the DIV boundry. All other <p> in HTML are fine, but the PHP appears to ignore the CSS.

Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: PHP code not being formatted by CSS

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3635
  • View blog
  • Posts: 5,756
  • Joined: 08-June 10

Re: PHP code not being formatted by CSS

Posted 20 March 2012 - 05:49 PM

PHP has nothing to do with CSS. The only thing PHP does is create the HTML for the page. - PHP is server-side while the HTML, CSS and Javascript are client-side. They don't work directly together.

If your CSS is not being applied to the HTML that PHP is generating, then there is a problem with the HTML or the CSS. Go through the HTML source you receive in the browser and see if it's all as expected. If you can't find the problem, post the CSS and HTML here (not the PHP code, only the HTML it generates) and we'll see if we can help you find it.

This post has been edited by Atli: 20 March 2012 - 05:50 PM

Was This Post Helpful? 0
  • +
  • -

#3 e_i_pi  Icon User is offline

  • = -1
  • member icon

Reputation: 782
  • View blog
  • Posts: 1,663
  • Joined: 30-January 09

Re: PHP code not being formatted by CSS

Posted 20 March 2012 - 05:50 PM

Is this the entire code for the file? It might help if we can see the entire HTML/PHP file, as well as the CSS.
Was This Post Helpful? 0
  • +
  • -

#4 don57  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 56
  • Joined: 15-March 12

Re: PHP code not being formatted by CSS

Posted 20 March 2012 - 06:38 PM

My CSS and HTML code are fine, my website has been up and running for a while with no problems I need to use PHP to pass a pointer to use as a delimiter in a condition branch statement to get rid of some redundant pages, and to do an e-mail form. However I can't play with the code if I can't get a reliable output. I think that my IDE codelobster is the problem. However I am unsure how to call the code from IE9. I think you type in the URL http://localhost after that I am unsure. I am using XAMPP 1.7.7 and my test files are in c:/xampp/htdocs/test.

Any help would be appreciated.

Thanks
Was This Post Helpful? 0
  • +
  • -

#5 AVReidy  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 65
  • View blog
  • Posts: 431
  • Joined: 17-February 11

Re: PHP code not being formatted by CSS

Posted 20 March 2012 - 06:45 PM

If your files are in the correct root directory for the server, and the server is powered on, you shouldn't have to do anything other than type in localhost to see your website.
Was This Post Helpful? 0
  • +
  • -

#6 exiles.prx  Icon User is offline

  • D.I.C Head

Reputation: 65
  • View blog
  • Posts: 239
  • Joined: 22-November 10

Re: PHP code not being formatted by CSS

Posted 20 March 2012 - 06:57 PM

If your files are located in localhost/test then the url you need to use to view your site is localhost/test. However, I would recommend eventually setting up the site using vhosts. This is how most (if not all) sites are setup and you will learn many new things as well (ex: apache config, htaccess commands, etc).

This post has been edited by exiles.prx: 20 March 2012 - 07:07 PM

Was This Post Helpful? 0
  • +
  • -

#7 don57  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 56
  • Joined: 15-March 12

Re: PHP code not being formatted by CSS

Posted 21 March 2012 - 08:12 AM

Finally got things working. It seems that Codelobster, does not display the output properly with XAMPP on windows7, neither does EasyPHP. I just put my code in the htdocs folder, and call the localhost from my browser and everything is fine. My CSS formatting is fine. The htdocs folder is a little crowded with files from appache. I tried making modifications to the httpd-vhosts file, so that I could set up a folder called test in htdocs. Didn't work, I do somemore research and try again. At least I can write code and view my output, the help has been greatly appreciated.

Thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1