Using Dreamweaver to edit *partial* web page (chunks of HTML code)?
- January 25, 2010
- 1 reply
- 2260 views
Hello,
I am using a custom PHP framework to build a website.
This framework is quite simple, it relies on 2 types of files:
- Templates: site-wide PHP/HTML files including all the logic, HTML header (links to CSS & JS files), Company logo HTML menus & related navigation code, searchbox, footer etc. Only 2 templates exist: one for the homepage, another one for all the other pages.
- "content files": these files contain mostly static HTML code. Content files are imported by the PHP template using PHP's include() function.
As content files are inserted within a global HTML page, these only contain chunks of HTML code: no tags such as "head" "body".
On the attached PNG, the green part is the code from the template, the red part is the code from the "content file".
A typical template file would be:
<html>
<head>
(load CSS files, JS files...)
</head>
<body>
(HTML headers & menus)
<?php include($content_file); ?> <!-- Includes partial HTML file with page content -->
(HTML footer)
</body>
</html>
A typical content file would be:
<h1>TITLE</h1>
<h2>subtitle</h2>
<p>Lorem ipsum<img src="" class="myimg" /></p>
<h2>subitle</h2>
<p>Lorem ipsum</p>
Templates are NOT editable by users.
Content files are editable by users, using Dreamweaver.
The problem is, users cannot edit those content files since it is not a valid HTML page. The CSS required to enforce the styles are not loaded since HTML headers are not present. It looks ugly and Dreamweaver tries to insert standard HTML tags such as <html>, <body> and so on.
I see 2 hypothesis, but I cannot find an answer in the Dreamweaver documentation:
- have DW edit the content files alone, in which cas we would need to tell DW that it is editing a partial web page and not a full one
- have DW edit the content file while applying the PHP template, in which case we would need to tell DW that is should discard most of the code and save only the "content file"
Hypothesis 1: Standalone edit of content files. Is there a way to tell Dreamweaver
- that it is editing a partial HTML file,
- that it needs to load additional CSS stylesheet to display the styles
- that it should not insert standard HTML body and headers tags, that we know the page is not standard compliant as-is
- that creating additional style is forbidden, it is only allowed to use styles defined in the stylsheet
Hypothesis 2: Edit of content files within the template. is there a way to tell Dreamweaver
- that it is should add HTML code from the template before and after the loaded "content file"
- that when saving the "content file" it should discard all HTML/PHP code from the template, saving only the content itself
- that creating additional style is forbidden, it is only allowed to use styles defined in the stylsheet
I cannot believe noone has been faced with this problem before, the fact is I cannot find any answer about this issue.
Best Regards,
M
