ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Sorry, I'm not too sure about your problem. But you can do stuff like:
<html>
<head>
<title>Welcome to my site!</title>
</head>
<body>
<?php
echo 'Hello World!';
echo "</body>";
print "</html>";
?>
Hope this helps. Notice, echo and print (afaik) do exactly the same task. To print text or html tags, you must enclose the text imbetween " " or ' '.
You would use php to "print" the tags you seek to create. There are a number of methods for doing this - the most common of which is surrounding logic and variables. You can assign a variable in php, and then use the logic to control what HTML is generated......
As for printing plain HTML in PHP, I want to note that one can simply exit PHP mode with "?>" and reenter PHP mode with "<?php" and it is equivalent to echoing everything within those tags. Even when you use this technique inside of a conditional (if, etc.) block or loop, the echoing only happens when the block is actually executed, just like you would expect from regular "echo" statements.
Quote:
Originally posted by charnel And Can I use variables in html with that technique
thank you all for your replies...But I think there aws an another way to insert html into php than echo all the lines... The thing that I am tring to do is to create a new html or php file with fopen command....
Originally posted by charnel thank you all for your replies...But I think there aws an another way to insert html into php than echo all the lines... The thing that I am tring to do is to create a new html or php file with fopen command....
If you find that other way, do tell us - I don't think it exists. PHP blocks are replaced by the browser with the output of the PHP block, so if you don't print or echo anything, you get an empty block. The way to insert HTML into a PHP file without echo90ing it is to enclose it between ?> and <?php tags.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.