Glom Posted October 14, 2006 Share Posted October 14, 2006 At the moment, I write the arguments using some very simple markup. <h3 id="bookmark">The argument.</h3> This is fine at the moment, but as I start devising a php version of my website, I'm thinking about instead using a function that will take the bookmark and argument as parameters and use them to construct the markup. Since this function will be in an external page, if I wanted to change the way I display an argument, I could simply change the function.The problem is I need to put the attribute in scare quotes and for this, I need to use the HTML entities. Unfortunately, I can't get the php right for converting the entities to characters so the page is constructed properly. It leaves the HTML entities as HTML entities.Here is the php at the moment. <?php function writeArgument($bookmark,$argument) { $arg1 = "<h3 id=""; $arg2 = "">"; echo html_entity_decode($arg1) , $bookmark , html_entity_decode($arg2) , $argument , "</h3>";}?> BTW, if anyone thinks I'm being overly pedantic by trying to do this in the first place, just say. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 14, 2006 Share Posted October 14, 2006 I'm not sure what your question is, it sounds like you either want to display quotes, or display HTML characters. To display a quote, you need to escape it:$str = "<h3 id=\"$bookmark\">";To display HTML characters, there is a builtin function for that:echo htmlentities($str); Link to comment Share on other sites More sharing options...
jhecht Posted October 15, 2006 Share Posted October 15, 2006 Uhm... What exactly would be the point in all fo this because i am so not seeing anything that you would need to do in this...htmlentities, htmlspecialchars, those may be the ones you want to look up on php.net...Other than that, i have no idea what ur talking about. Link to comment Share on other sites More sharing options...
Glom Posted October 15, 2006 Author Share Posted October 15, 2006 Thanks. That worked great. It is sort of like C++. The idea is that I currently construct an argument using a simple h3 setup as I showed. I also id them all to so I can link directly to them as required. The thing I'm trying to do is to create a php function, contained in a master file, that will allow me to instantly change the way I construct them if I want to (for example, I might want to use a bullet point instead or something for some strange reason). Link to comment Share on other sites More sharing options...
boen_robot Posted October 15, 2006 Share Posted October 15, 2006 Thanks. That worked great. It is sort of like C++. The idea is that I currently construct an argument using a simple h3 setup as I showed. I also id them all to so I can link directly to them as required. The thing I'm trying to do is to create a php function, contained in a master file, that will allow me to instantly change the way I construct them if I want to (for example, I might want to use a bullet point instead or something for some strange reason).I think storing data for almost any sort of reason, including a functional one is the purpose of XML. If you use it instead, it will be somewhat easier, scince you'll deal with the elements as individual elements, instead of dealing with the whole file as one big text string. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now