View Full Version : Gallery description changed - why?
iamback
Jun-12-2007, 12:42 PM
I just experimented a little with editing a gallery description. Instead of just plain text, I changed the content to have a (h2) heading, followed by a paragraph (p) of text.
To my disappointment I found that while the heading is preserved, the paragraph is no longer a paragraph: the start and end p tags are stripped from the code that is generated into the page. My code is obviously stored though: the "edit" link has a textarea with the complete text, including paragraph tags.
Why are these tags stripped when my content is inserted into the page? I write structural code, I'd like to keep it that way!
Besides, I base my styling on the code I write - if that code is changed from under my hands customization becomes a lottery.
Mike Lane
Jun-12-2007, 01:06 PM
I just experimented a little with editing a gallery description. Instead of just plain text, I changed the content to have a (h2) heading, followed by a paragraph (p) of text.
To my disappointment I found that while the heading is preserved, the paragraph is no longer a paragraph: the start and end p tags are stripped from the code that is generated into the page. My code is obviously stored though: the "edit" link has a textarea with the complete text, including paragraph tags.
Why are these tags stripped when my content is inserted into the page? I write structural code, I'd like to keep it that way!
Besides, I base my styling on the code I write - if that code is changed from under my hands customization becomes a lottery.Surround it with html tags and your html will stay (and the html tags will get stripped). :thumb
iamback
Jun-12-2007, 11:46 PM
Surround it with html tags and your html will stay (and the html tags will get stripped). :thumbGosh, really? So those html tags are not really html tags - that's pretty counter-intuitive for someone who's used to typing HTML and making sure it's valid. :wink
Testing... I find I have to add a space between the h2 tag and the p tag in order to get it it generate a correct meta description tag, but indeed the code is preserved (except for the html tags). Thanks! :thumb
I have not seen that described anywhere in a tutorial or customization FAQ though - did I miss it or is it missing? In the latter case it would be useful to add.
If I type HTML in the global customization form (without adding html tags, of course) it seems to be preserved - so where, exactly, would this trick be needed and where not?
Just curious - why was it implemented that way then, why not just preserve the content as is? Or use some non-html marker to signal "don't change this"?
Mike Lane
Jun-13-2007, 01:23 AM
Gosh, really? So those html tags are not really html tags - that's pretty counter-intuitive for someone who's used to typing HTML and making sure it's valid. :winkYeah I know. But it works. :thumb
Testing... I find I have to add a space between the h2 tag and the p tag in order to get it it generate a correct meta description tag, but indeed the code is preserved (except for the html tags). Thanks! :thumbNo problem.
I have not seen that described anywhere in a tutorial or customization FAQ though - did I miss it or is it missing? In the latter case it would be useful to add.It's in the help pages, but I'll see what I can do to make it a bit more prominant. It does come up a lot on dgrin and in the help desk. Thanks for the suggestion.
If I type HTML in the global customization form (without adding html tags, of course) it seems to be preserved - so where, exactly, would this trick be needed and where not?All comments and gallery descriptions. Um, the bio too. I'm probably forgetting places. Basically, if you come across a situation where you know darn well you put in valid html and it isn't showing, try surrounding it with html tags.
Just curious - why was it implemented that way then, why not just preserve the content as is? Or use some non-html marker to signal "don't change this"?I'm pretty sure the thinking is that there is some basic html formatting done to comments, the bio, and gallery descriptions (again I may be forgetting some places) and that there needed to be a way for the user to force the site to not put that default formatting in. That was the way that JT came up with and it works just great. I'm guessing that he could use any string and that it's either javascript or php that parses it (honestly I don't know, the deets, this is just a guess). But since we know for sure nobody is going to be using any html tags in their customizing and since it just kind of makes sense for all the non html geeks out there to start their html with <html> and to end it with </html> I think that is what made the most sense.
I know for people who are in to the nitty gritty when it comes to html and css it's a bit counter-intuitive at first. But you'll see that it works great and it's not that hard to get used to.
Hope that helps.
iamback
Jun-13-2007, 06:50 AM
All comments and gallery descriptions. Um, the bio too. I'm probably forgetting places. Basically, if you come across a situation where you know darn well you put in valid html and it isn't showing, try surrounding it with html tags.Brilliant. :rolleyes I'll try to keep a list of what I stumble over...
I'm pretty sure the thinking is that there is some basic html formatting done to comments, the bio, and gallery descriptions (again I may be forgetting some places) and that there needed to be a way for the user to force the site to not put that default formatting in. That was the way that JT came up with and it works just great.Now I know, yes it does work well. I can see the reasoning now: if there's no signal, the site does its own formatting, Markdown-like (or rather nl2br-like - I saw a <br> tag being inserted).
But I'm kind of um, leary?, about adding html tags everywhere (everywhere HTML is expected) when I don't know for sure they'll be removed, because that would surely break the whole page, and not just the section I'm editing. Or is it a general rule that (surrounding) html tags are always removed?
But you'll see that it works great and it's not that hard to get used to.Sure, I'll get used to it. Don't forget I've been here only a week or so. (Though I've been studying hard, here, and at Zenfolio, and at Flickr. No promises but it's likely by now I'll sign up by the end of the week, in spite of all my :bash yesterday - had a bit of an overdose. There are things I like a lot and there are things I don't like at all - but it kind of balances out.)
Allen
Jun-13-2007, 07:02 AM
...
But I'm kind of um, leary?, about adding html tags everywhere (everywhere HTML is expected) when I don't know for sure they'll be removed, because that would surely break the whole page, and not just the section I'm editing. Or is it a general rule that (surrounding) html tags are always removed?
...
If I understand things, don't really know much about this, that the only place
the <html></html> tags are needed is in any text box out on the gallery
pages. Like bio, album description and caption boxes.
iamback
Jun-13-2007, 07:10 AM
If I understand things, don't really know much about this, that the only place
the <html></html> tags are needed is in any text box out on the gallery
pages. Like bio, album description and caption boxes.OK, that sounds like a reasonable guess. I'll experiment a little (later, need to run some errands) to see if I can come up with a real "rule".
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.