Highlighted

Device Preview in PHP using includes?

New Here ,
Feb 19, 2018

Copy link to clipboard

Copied

I'm loving the Device Preview option, but I'm a bit stuck trying to figure out if it's possible to set it up using includes.

For instance, let's say that I load everything from index.php, which has "include($_GET['page'].'.php')" - so while I'm working on the index file, I can see the homepage just fine, but let's say in case of "index.php?page=contact" - I would need to edit the contact.php file, however, when I open that file, it wouldn't load through the index, it "thinks" it's own page... which makes sense, but is there any way to set it up so that I can open contact.php in Dreamweaver and see "index.php?page=contact" in the device preview?

Adobe Community Professional
Correct answer by BenPleysier | Adobe Community Professional

You can't because Real-time Preview runs inside a shell. The only way to see your page is by right-clicking on the page -> This Frame -> Open Frame in New .. as in the following and then entering the URL parameters.

TOPICS
Learn Dreamweaver

Views

365

Likes

Translate

Translate

Report

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

Device Preview in PHP using includes?

New Here ,
Feb 19, 2018

Copy link to clipboard

Copied

I'm loving the Device Preview option, but I'm a bit stuck trying to figure out if it's possible to set it up using includes.

For instance, let's say that I load everything from index.php, which has "include($_GET['page'].'.php')" - so while I'm working on the index file, I can see the homepage just fine, but let's say in case of "index.php?page=contact" - I would need to edit the contact.php file, however, when I open that file, it wouldn't load through the index, it "thinks" it's own page... which makes sense, but is there any way to set it up so that I can open contact.php in Dreamweaver and see "index.php?page=contact" in the device preview?

Adobe Community Professional
Correct answer by BenPleysier | Adobe Community Professional

You can't because Real-time Preview runs inside a shell. The only way to see your page is by right-clicking on the page -> This Frame -> Open Frame in New .. as in the following and then entering the URL parameters.

TOPICS
Learn Dreamweaver

Views

366

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 19, 2018 0
Adobe Community Professional ,
Feb 19, 2018

Copy link to clipboard

Copied

Do you have a local testing server?

Nancy O'Shea, ACP
Alt-Web Design & Publishing

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 19, 2018 0
Community Beginner ,
Feb 19, 2018

Copy link to clipboard

Copied

Yes, I do. That's what I mean. index.php will load fine, and when I go to contact.php, it also shows me contexts of that php file, but I'm hoping to figure out a way to load index.php?page=cotact when I'm editing contact.php.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 19, 2018 0
Adobe Community Professional ,
Feb 19, 2018

Copy link to clipboard

Copied

You can't because Real-time Preview runs inside a shell. The only way to see your page is by right-clicking on the page -> This Frame -> Open Frame in New .. as in the following and then entering the URL parameters.


Ben

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 19, 2018 1
Community Beginner ,
Feb 19, 2018

Copy link to clipboard

Copied

Yes, I can inspect it and see the frame. I was curious if anyone created some sort of workaround for similar situation either using actual php code or .htaccess routing.

The best I came up with thus far is setting a flag in index.php and then redirecting when to index when flag isn't detected, but it seems very hacky.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 19, 2018 0
Adobe Community Professional ,
Feb 19, 2018

Copy link to clipboard

Copied

Have you tried Brackets? It would be interesting to know if it works in Brackets.


Ben

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 19, 2018 1
ToloUSN LATEST
Community Beginner ,
Feb 19, 2018

Copy link to clipboard

Copied

No, I haven't used Brackets before. I mean, the default preview seems to be doing it's job, so I'd assume brackets would work exactly the same.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 19, 2018 0