Jump to content


This topic is now archived and is closed to further replies.


Allow Editable PHP Variables Dreamweaver Templates

Recommended Posts



I'm a PHP developer who is relatively new to Dreamweaver. I am setting up Dreamweaver templates for one my clients who will be using Dreamweaver to edit/add pages. I have set-up editable HTML regions, but I'd like to know if there is a way set-up a PHP variable such that only the value is editable. For example, in the following code:


    $page_name = 'Contact Us';


I would like the user to be able to change "Contact Us" to whatever they would like, but not to be able to change the PHP code. Is this possible with Dreamweaver MX 2004?


Any help is greatly appreciated.


Daniel Leighton

Share this post

Link to post
Share on other sites

Hi there,


I am on the other end of the stick :P

I am designer/learning php.


Anyhow, I really suggest you look into Contribute by Macromedia. This package will let the client edit only what you specify in Dreamweaver as editble/non editble, plus allows them to upload/download the pages directly via secure ftp. This way, they can easily update..(worthwhile looking @).


Anyhow, to answer you question, If you use dreamwesver editble/non editle tags, It will surely disrupt your <?php ?> tags.

The solution IMO, may be in the user creating new pages from a template (that you have designed), then they can save as a new page. Then, so they don't need to add to the menu, they can save to a specified folder, such as "content", then set your navigation to build dynamically, such as:



// thanks to lixlpixel for this

$dir = './content';

$dh = opendir($dir);
while($file = readdir($dh))
   if ($file != '.' && $file != '..') // add filter here ...
      // for example  && substr($file,0,-4) != '.txt' to filter out text files
       $dname[] = $file;

reset ($dname);

// we have an array $dname here now ...

for ( $i = 0; $i < count($dname); $i++ )

   // bold if its the active you will want to change the index.php to page_self or similar
   if(substr($dname[$i],0,-4) == $_GET['page']) echo '<b><a href="$PHP_SELF?page='.substr($dname[$i],0,-4).'">'.substr($dname[$i],0,-4).'</a></b><br />';
   else echo '<a href="$PHP_SELF?page='.substr($dname[$i],0,-4).'">'.substr($dname[$i],0,-4).'</a><br />';


and have a content designated area for the content, called "page", as such:

switch ($page) {
# start of main profile categories
  case "profile":
  case "directors":
  case "advertisers":
# this is default if file not present


But this is the part I am trying to make dynamic, so the switch cases, get built dynamically like the menu. I know this may be off course a bit, but it bascically heads in your direction. That way the content they update, could simply be a text file with all the html stripped out. Then the pages could have headers etc. < mebbe you may come up with a gr8 soulution?


I hope I haven't gone off the beaten path,


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.