Can an entire site be typed with pure PHP 
PHP Question
You cant code the layout with php I think. But I might be wrong and do you mean EVERYTHING in php with no html/css ect.
though it is possible it woud be beyond extremely dodgy, PHP is not designed for full site coding it is designed as the programming and data support for HTML pages which in addition can use css.
you need other web language,like css to design web style and html to make basic web frame and javascript to make good effect for client!
i dont think a stand alone php site will be functional. html is absolutely needed for basic page design
php is a programming language. It creates a program to do tasks. It doesnt format text or anything so not really.
On the other hand though without using html/css you can display just text but without these two you cannot have anything else such as tables, colours, links etc.

On the other hand though without using html/css you can display just text but without these two you cannot have anything else such as tables, colours, links etc.
| idolztheunknown wrote: |
| Can an entire site be typed with pure PHP |
Well, you can generate all HTML/CSS/Javascript output with PHP. In some cases it may be quite reasonable.
There is a bunkle of PEAR::HTML packages producing various HTML content such as tables, forms, and even whole pages.
is it possible to insert a PHP tag inside a javascript and combine them like combining HTML and PHP?
Last month I have one question because I want run PHP script with users local time. Because, PHP haven’t possibility to get users local time I am using few lines of JavaScript. In that time I find out that is possible to pass values from PHP to JavaScript, but not from JavaScript to PHP.
Passing values from PHP to JavaScript:
or
But this is not solved my problem. After little experiment (because my JavaScript knowledge are very poor), I solved problem with small peace of PHP and JavaScript on the top of my page. If is claimed information's empty JavaScript redirect users to the same page with information's in address bar.
Sonam
Passing values from PHP to JavaScript:
| Quote: |
| <?php $a = 2; ?>
<script type="text/javascript"> <!— var a = <?php echo $a;?>; //--> </script> |
or
| Quote: |
| <?php $a = 2;
echo "<script type=\"text/javascript\"> <!—var a = $a; //--> </script>"; |
But this is not solved my problem. After little experiment (because my JavaScript knowledge are very poor), I solved problem with small peace of PHP and JavaScript on the top of my page. If is claimed information's empty JavaScript redirect users to the same page with information's in address bar.
| Quote: |
| $time = $_GET['time'];
$h = $_GET['h']; if(empty($h)){ echo '<SCRIPT LANGUAGE="JavaScript"> <!-- var now = new Date(); var y = now.toTimeString(); window.location="?time="+y+"&&h=yes"; //--> </script>'; exit; } else { … |
Sonam
You "COULD" do pure php websites, but they are quite small. You can't put in much format. You wouldn't be able to have any links. You could do a single page with php, but it would be all images and unformated text.
It isnt actually a good idea to use PHP for your whole site, as it puts a lot of strain on servers and your loding time would be really slow because PHP has to read all your code and then output it as HTML.
You can absolutely write a whole site in PHP with the exact same content and functionality as HTML by echoing out markup, but th question is why would you. It only takes 2 characters to switch in and out of PHP, it would be madness to echo all your markup and run it through the php parser.
| JustaMin wrote: |
| You can absolutely write a whole site in PHP with the exact same content and functionality as HTML by echoing out markup, but th question is why would you. It only takes 2 characters to switch in and out of PHP, it would be madness to echo all your markup and run it through the php parser. |
by echoing markup your still using something other than just PHP aren't you.
Anyway to finalise this topic as its now starting to get spammy.
Yes you can but all you will get is plain text with no formatting so it would be stupid. Use HTML and/or css.
-close-
