Click to See Complete Forum and Search --> : Dreamweaver and php?
gmdavis
08-28-2003, 12:14 AM
I hate asking such a basic question but...
I have been coding my PHP site in text editors exclusively for several months. Most of the pages are just a bunch of includes based on an included html framework.
I finally got Dreamweaver and imported my entire site. However, in dreamweaver, every page shows only the code, no WYSIWYG preview available just a blank window.
What good is this? Basically I have a much more expensive text editor.
Is there some setting I need to change or maybe Dreamweaver lets you use PHP but only if you follow certain rules. What's the trick? The documentation doesn't say much about PHP.
BTW, if this has anything to do with it, my files typically have an .html extension, not .php. Thsi works fine on my server as the Apache config files have been modified to parse html files for PHP. I'm thinking maybe Dreamweaver doesn't expect this.
stolzyboy
08-28-2003, 11:21 AM
yeah, that could likely be your problem, a simple test would be to change one of the pages to .php and give it a whirl
mzanimephp
08-28-2003, 05:50 PM
Do you have Dreamweaver MX? If your using version 4 then you might as well throw in the towel. Ver.4 has vertially no dynamic support compaired ot DWMX.
Aso, If you have your include setup to echo (http://us4.php.net/echo) every single HTML line then they won't display included in wysiwyg view. But if the contents of the includes are entirely HTML then they should be visible in wysiwyg.
gmdavis
08-28-2003, 11:17 PM
YesI do have Dreamweaver MX. Just got it so it's the latest.
Not every html line of my includes is echoed but a fair amount. I will continue to experiment when I have a minute.
mzanimephp
08-29-2003, 01:37 AM
Well thats the reason why Dreamweaver doesn't display them in wysiwyg view.
Dreamweaver won't display:
echo "<head>";
echo "<title>Untitled</title>";
echo "</head>";
But it will display plain code inside a PHP include:
<head>
<title>Untitled</title>
</head>
So you should try to display as much plain HTML as possible. And too this helps PHP, because PHP skips HTML code when parsing But if you go <?php echo HTML CODE ?> then it makes it parse extra PHP unecessarily, when you can simple leave it as regular HTML code..
futureshock
08-30-2003, 09:34 AM
We must remember that PHP is produced on the server side and not on the client/browser end, and MX displays the layout view with a dumbed down browser type setup.
To be able to fully view what your PHP code will do and look like, you must set up MX to also work with a 'test server'.
If you do not have the 'test server' defined then you will not be able to view any dynamic content produced by PHP.
Basicly what you do is, define your test server (nothing more then redefining your site connection parameters under a different section). Then when you want to view what your PHP 'actually' looks like, you hit F12 (preview in browser) and MX will send the page to where you defined your test server and then display it in the browser after being processed.
Also as mz said above, how you implement your html/php code with each other helps.
For instance when I create dynamic tables I mix both styles of output.
<html>
<body>
<table>
<?
while($row = mysql_fetch_array($results))
{
?>
<tr>
<td>col1</td>
<td>col2</td>
<td>col3</td>
</tr>
<?
}
?>
</table>
</body>
</html>
This will allow you to view a single row of a table in 'layout' view resizing or CSS editing.
I personally don't use the preview in browser feature, I usually keep my site open and then when I have edited a page, I upload it and then view it from the net.
I hope this helps.
I code all my pages exclusivley using MX and most pages are extremely PHP laden so I have learned a few tips and tricks.
If you have any questions you can contact me directly at: scotyj1@cox.net
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.