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

Device Preview in PHP using includes?

New Here ,
Feb 19, 2018 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?

Views

529

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
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 19, 2018 Feb 19, 2018

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.

Votes

Translate

Translate
Community Expert ,
Feb 19, 2018 Feb 19, 2018

Copy link to clipboard

Copied

Do you have a local testing server?

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

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
community guidelines
Community Beginner ,
Feb 19, 2018 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.

Votes

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
community guidelines
Community Expert ,
Feb 19, 2018 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.

Wappler, the only real Dreamweaver alternative.

Votes

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
community guidelines
Community Beginner ,
Feb 19, 2018 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.

Votes

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
community guidelines
Community Expert ,
Feb 19, 2018 Feb 19, 2018

Copy link to clipboard

Copied

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

Wappler, the only real Dreamweaver alternative.

Votes

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
community guidelines
Community Beginner ,
Feb 19, 2018 Feb 19, 2018

Copy link to clipboard

Copied

LATEST

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.

Votes

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
community guidelines