PHP Help

free web hosting
Free Web Hosting > Computers & Tech > Designing > Web Design and HTML

PHP Help

shahzadkhandotcom
i need to know , how can i add html codes in PHP site ,

like

<?php
print("Hello");
?>

i ever use the print command , i am fed up from writing print



any easy solution....


Please

Reply

japanick
I think you should clarify what you are trying to get an answer for.

If you have a PHP file, and you want to write html in it, you do not need to write it in between the <?php and ?> tags, instead just put your html tags and text outside those tags as normal.

For example:

<H1>This is a Heading</H1>
<?php
echo "This is PHP code.";
?>

<B>Here is more HTML</B>


If you need to have the HTML inside the PHP, then you will just have to get used to writing either print or echo whenever displaying HTML. It's not that bad.

Reply

chronogamer28
Sorry, I don't use PHP, I use an IPB for my site.

Reply

mastercomputers
QUOTE(shahzadkhandotcom @ Oct 11 2004, 09:59 AM)
i need to know , how can i add html codes in PHP site ,

like

<?php
print("Hello");
?>

i ever use the print command , i am fed up from writing print
any easy solution....
Please
*



Your question is a bit hard to understand.

You can escape and re-enter php.

Instead of doing something like

CODE
<?php
... your code
echo '<p>Hello</p>';
... more code
?>


You could just do

HTML
<?php
... your code
?
>
<p>Hello</p>
<?php
... more code
?
>


by escaping out of PHP, we can use normal HTML code. We can even write a .php file and only have HTML code in it by not using <?php ?> tags, what purpose does it serve?, maybe just the ability to later include PHP to that file, but it's not hard renaming a .html file to .php.

If you mean, you use PHP to write all your HTML code, using print or echo, there are convertors out there that can turn your HTML code to PHP, but all it's doing is putting echo statements in place of the HTML tags, escaping characters that could give php trouble and enclosing it within quotes, it's not really worth processing cycles to do HTML with php echo statements.


Cheers, MC

 

 

 


Reply

avalon
You can have HTML code and PHP code in one php file.

Just make sure all PHP code start with:-

<?php

and end with:-

?>

As for HTML code, just leave it as it is, just like a normal HTML page.

Need more detail explaination?

Just let me know.

biggrin.gif

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Similar Topics
Looking for php






*SIMILAR VIDEOS*
Searching Video's for php
advertisement




PHP Help