Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Liveview problem rendering PHP from HTML files?

Explorer ,
Oct 20, 2010 Oct 20, 2010

I'm wondering if anyone else has seen this, or if it's a known limitation.  If I open an HTML file in liveview that has links to PHP files and click on one of those links, the link will work correctly and I can view the PHP file that I've navigated to, but PHP within that file is not interpreted correctly.

If I go into livecode, I see that a statement in the original PHP file source such as:

<img src="images/son<?php echo $_GET['pg'] ?>.jpg" alt="" width="333" height="241" class="fltlft" />

is translated into:

<img src="images/son&lt;?php echo $_GET['pg'] ?&gt;.jpg" alt="" width="333" height="241" class="fltlft">

So the PHP brackets are being treated as character entities rather than brackets.  If I open the PHP directly and view that in liveview, all is fine.

Using DW CS5 with XAMPP for PHP 5.31.

Is there any setting I can change to workaround this?

PS: Ironically, I note that the spellchecker for this page makes the same substitutions to the PHP command brackets if I run it on the post...

TOPICS
Server side applications
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Oct 21, 2010 Oct 21, 2010

What does the URI say in the address field of the Live View toolbar? If the URI looks like "file://.../page.php" or "file://.../page.html" with the word "file" at the front then the live view source is getting read straight from the disk instead of going through your webserver and the php processor. Go to the Live View Options menu and select "Use Testing Server for Document Source". This should force Live View to get the page through the testing server and hte URI should start with "http" like

...
Translate
Guest
Oct 21, 2010 Oct 21, 2010

What does the URI say in the address field of the Live View toolbar? If the URI looks like "file://.../page.php" or "file://.../page.html" with the word "file" at the front then the live view source is getting read straight from the disk instead of going through your webserver and the php processor. Go to the Live View Options menu and select "Use Testing Server for Document Source". This should force Live View to get the page through the testing server and hte URI should start with "http" like "http://localhost/.../page.php". By default in Live View static html pages are read off the disk as "file" while dynamic pages like php use the testing server and start with "http". The initial page you opens determines this for all the links you click on, so if you open an html page first it's going to use the local "file" for all the relative links. You could also fix this my opening a php page first and following that link.

Here's an image of that setting that controls this:

testingServer.jpg

Hope this Helps,

Chris

Adobe Dreamweaver Engineering

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 21, 2010 Oct 21, 2010

Chris,

Thanks, is EXACTLY what I was looking for. Works fine now.

One other question if I may; what I'd also like to be able to do is to set a URL parameter when viewing a page in Liveview, but changing the value in the address bar doesn't seem to work.  So for example, if I start off by viewing a HTML page and then navigate to a PHP page (now working correctly) in Liveview with a URL like http://localhost/zeigler/son_oeuvre.php?pg=2  What I'd really like to be able to do is to set pg=3, 4, 5, etc from the Liveview window.  Any easy way to do this?  The only configuration setting I can find is to set a URL parameter for the original HTML page I opened.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 21, 2010 Oct 21, 2010

I think you can type the query string into the address bar and hit return and see if that reloads it for you. If you are entering the same values all the time then you can also go to that same Live View Options menu and now choose the "HTTP Request Settings..." at the very bottom. Here you can set the query string, just put pg in the name column and 2 as it's value. Now each time you start live view for this page the query string "?pg=2" should get appended to the URI.

Chris

Adobe Dreamweaver Engineering

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 22, 2010 Oct 22, 2010
LATEST

Chris,

No, that's what I meant; adding the parameter to the URL in the address bar doesn't reload the page with the new value.  Since you're in Adobe Enginerring, I'll say it would really be nice if it did ;-).

Some other thoughts about the way the Live View works:

Seems that there is no configuration option (at least that I can find) that lets me select the source of the files Live View uses - i.e., to set it to always use the local file system or a testing server.  I think it can only be done on page basis, using the Live View option drop down as you said.  Again, would be nice if there was an option to set default.

Also, now understanding that Live View uses one or the other (local files / testing server) explains what seemed erratic behavior - sometimes it asked if I wanted to upload the file, other times it didn't.  Of course I just didn't realize that it was using a different source (which I should have), but maybe something pointing that out would have helped.

And finally, one of the problems is that even if I do upload the file to the testing server, it's only uploading that file and there can be other files that are linked to in the file I'm currently viewing that are stale, so if I start clicking on the links in the current file the other files are out of date.  So then I need to get out of Live View, synch the testing server and start all over.  Would again be nice if the message that asks me if I want to synch the file when I start Live View also had a "synch all testing server files" option.  That way if there are files I don't want to overwrite I don't need to, but if I want a view of the current state of all of the files I can get it in one click.

Thanks again.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines