Skip to main content
Participating Frequently
May 31, 2021
Question

Struggling to "browse" through the website using Dreamweaver because of Session Variables

  • May 31, 2021
  • 4 replies
  • 964 views

Hey there,

So I have previously created a website using a different text editor, giving Dreamweaver a try for more options/ease of use.
All of the webpages contain a piece of script that'll redirect you if you haven't set your username via the login page:

if (isset($_SESSION['userName'])) {
	;
}
else {
	header("Location: ../index.php?error=notloggedin");
	exit();
};

 

How would I be able to edit and view the page in design/live by setting the username variable in DW?

Thanks

This topic has been closed for replies.

4 replies

B i r n o u
Legend
June 7, 2021

Perhaps that I missed understood your request... but just in case...

 

I think that by the past Dreamweaver allowed us to easly set up such variables... now it seamed limited to HTTP parameters... View > LiveView Options > HTTP request parameters

 

anyway, if you have your $_SESSION verification on an include page, you could easly modify it and test to bypass the redirection by using $_SERVER['SERVER_NAME'] being or not equal to "localhost"

 

an other point, developping application on localhost, then pushing them on different remote, could lead to misinterpretation, or poor formatting, of access paths. to avoid this, I'm used to format the include path, that way

 

 

'/'.trim( $_SERVER['DOCUMENT_ROOT'], '/' ).'/your_path_inc/__SESSION__.php'

 

 

this way the formatting will always be adapted whether the server returns the presence or not of the root slash, properly linked to the different configuration of some packages set (wamp, xampp, easy, and many many others)

 

Nancy OShea
Community Expert
Community Expert
May 31, 2021

Dreamweaver's Design/Live views are neither browser nor web server.  Design/Live view are for visual design and text/code editing.   To test scripts, you need a local or remote server and a real browser (Chrome, Firefox, MS Edge, Safari). 

 

For local development, I prefer to keep my local site folder inside my testing server's default web directory. On Wamp, the directory is www.  On Xampp or Mamp, it's htdocs.  See screenshot.

 

 

This set-up eliminates the need for duplicate folders on my computer because testing and local are one in the same.  It's one less thing to think about. 

 

To mirror my remote environment, I use phpMyAdmin to export remote server's SQL data and then import with my local phpMyAdmin.  From start to finish, it takes about 50 seconds to log-in, export and import data.   But if that's too onerouse, simply upload files to your remote server and browse to the URL from your web browser.  Do not use Dreamweaver's Real-Time Preview.

 

Nancy O'Shea— Product User & Community Expert
We0ZAAuthor
Participating Frequently
May 31, 2021

Hey Ben,

I gathered that much, I was referring to the live view of the page.

Becuase my code re-directs you back to the index, if I want to have a live view of my page as I edit it on the fly, it shows me a live view of the index page because the session variable isn't set not the live view of the actual page being edited

BenPleysier
Community Expert
Community Expert
May 31, 2021

You will need to have a local server installed to run a PHP site. Fir Windows this would be a Wamp server, for Mac, a Mamp server.

 

Then place the website within the designated folder, i.e. for Wamp this is the `www` folder.

 

In Dreamweaver, you will then need to setup the site.

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
We0ZAAuthor
Participating Frequently
May 31, 2021

So I can't run it off the files from the remote site?

I have site connected and it puts files just fine, 

The pages seem to lad ok, it's just the PHP variables that aren't set.

If I set up a local site then I have to duplicate database changes and all the rest to my local site each time as well?

BenPleysier
Community Expert
Community Expert
May 31, 2021

Dreamweaver is basically a text editor. The difference lies in the inbuilt extras that Dreamweaver has over more modest editors.

 

In other words, there is no diffence in handling serverside code.

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Liam Dilley
Inspiring
June 7, 2021

Just a bit interested in what you think are the "moddest editors" out there at the moment?

BenPleysier
Community Expert
Community Expert
June 7, 2021

There is quite a list. a simple search will uncover them. IMO, I think that this is the standout: https://visualstudio.microsoft.com/

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!