Jump to content

Can this be done?


anya7

Recommended Posts

I’m working with a site that’s all (mostly) plain html done in Dreamweaver templates.  The site’s over 1000 pages and it’s had maybe a dozen different people updating it over the years which has lots of mis-matched, inconsistently done pages and a few entire sections that weren’t even done with the template.  I’ve been given the task of “fixing” it, so to speak.  The current system is obviously pretty inefficient so I was considering the possibility of switching it over to a php-based template system, which would look roughly something like this:

[code]
<? $title = “blah”;
include(“header.php”); ?>

html stuff blah blah
<? echo $title; ?>
more html stuff blah blah

<? include(“footer.php”); ?>
[/code]

The problem is that this would require whoever’s making the pages to escape all the quotes and semicolons and such that would be in the title (and they definitely will be there).  The regular web person always knows some html (enough to update the pages, anyway),  but not necessarily php and sometimes the pages are updated by other people, who don’t really know html but can manage to find their way through Dreamweaver with detailed instructions.  I don’t want to have to explain to them that they have to escape certain characters, and then trust them to remember to actually do it.  Is there any other way to accomplish getting stuff stored in a variable without having to escape anything?
Link to comment
Share on other sites

You can do
[code]<?php
$title = 'a title with a "quote" in it';
$title1 = "a title with a \"quote\" in it";
$double_quote = htmlentities('"',ENT_QUOTES);
$single_quote = htmlentitie("'",ENT_QUOTEs);
$title2 = "a title with a " . $double_quote . "quote" . $double_quote . " in it";
?>[/code]

Ken
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.