Page 1 of 1

php code inside html

Posted: Mon Jul 09, 2007 8:33 am
by superdez
I'm trying to erase the .html file extensions of all my links that are inside my web pages on-the-fly with php but at the same time make the links recognizable by DreamWeaver:

Code: Select all

<?php print ereg_replace(".html", "", '(html code goes here)' ); ?>

If I place this php inside the actual link or surrounding it, DreamWeaver does not recognize it as a link but as a "server side script":

Code: Select all

<h2><a href="<?php print ereg_replace(".html", "", 'category/file.html' ); ?>">Text</a></h2>

Code: Select all

<h2><?php print ereg_replace(".html", "", '<a href="category/file.html">Text</a>' ); ?></h2>

So, is it possible to position the php code so that the link itself is not surrounded and DreamWeaver will recognize it ?

Posted: Mon Jul 09, 2007 8:43 am
by feyd
If the changes are fairly static, which is what you've posted so far, why use PHP for this? Why not just rename them?

Posted: Mon Jul 09, 2007 8:43 am
by superdezign
No. What difference does it make that Dreamweaver knows?

Posted: Mon Jul 09, 2007 8:50 am
by superdez
DreamWeaver cannot work with files that do not have an extension. I know, its a little weird that after so many DreamWeaver versions, that is still not possible... but I cannot find any other good substitute product. :(

I use DreamWeaver because it checks for broken links sitewide which is a very convenient utility and because it also checks markup sitewide which is also very convenient. I cannot find any other product that does those 2 important things.

Posted: Mon Jul 09, 2007 8:57 am
by superdezign
Then why bother getting rid of the file extensions if the files exist?

Posted: Mon Jul 09, 2007 9:30 am
by s.dot
perhaps a call to echo or print?

Posted: Mon Jul 09, 2007 9:36 am
by superdez
According to w3c.org's recommendations, its better to not have extensions than to have them:
http://www.w3.org/TR/chips/#uri




I forgot to place the "print", is that what you were stating ? I changed my first post...

Posted: Mon Jul 09, 2007 9:53 am
by superdezign
superdez wrote:According to w3c.org's recommendations, its better to not have extensions than to have them:
http://www.w3.org/TR/chips/#uri
superdez wrote:ee it, but I skimmed.
superdez wrote:I forgot to place the "print", is that what you were stating ? I changed my first post...
Dreamweaver won't recognize it. It doesn't parse code (at least in v8 it doesn't).

Posted: Tue Jul 10, 2007 7:32 am
by superdez
Could anyone recommend me a good local site link checker and a local site validator ? I've downloaded a few of them but they all seem to be clumsy software and very inferior to DreamWeaver.