php code inside html

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
superdez
Forum Commoner
Posts: 33
Joined: Tue Jul 03, 2007 1:36 pm

php code inside html

Post 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 ?
Last edited by superdez on Mon Jul 09, 2007 9:34 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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?
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

No. What difference does it make that Dreamweaver knows?
superdez
Forum Commoner
Posts: 33
Joined: Tue Jul 03, 2007 1:36 pm

Post 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.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Then why bother getting rid of the file extensions if the files exist?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

perhaps a call to echo or print?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
superdez
Forum Commoner
Posts: 33
Joined: Tue Jul 03, 2007 1:36 pm

Post 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...
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post 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).
superdez
Forum Commoner
Posts: 33
Joined: Tue Jul 03, 2007 1:36 pm

Post 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.
Post Reply