Welcome to Geeklog, Anonymous Sunday, September 01 2024 @ 01:23 am EDT
Geeklog Forums
trailing slash inside story image tags?
Status: offline
thatlinuxbox
Forum User
Newbie
Registered: 09/04/13
Posts: 14
Location:Gainesville, FL
After upgrading to Geeklog 2.0 I went back to edit an existing story draft and noticed that the story editor was no longer displaying [image1], [image2] for images but instead was displaying the URL to the image.
If I create a new story with an image, I can edit the story and the image tags appear correctly.
I tracked this down to minor difference in the database but I'm not sure of the proper corrective approach.
On existing stories, the gl_stories table images look like this:
<img width="500" height="375" src="http://thatlinuxbox.com/blog/images/articles/20080120213334314_1.JPG" alt="">
On new stories, the gl_stories table images look like this:
<img width="600" height="450" src="http://thatlinuxbox.com/blog/images/articles/2013091714351166_1.jpg" alt="" />
Notice that the newly created stories have a trailing slash just before the img closing tag.
This is what the editor looks like for older stories. Instead of showing "[image1]" it shows the actual long URL:
http://imgur.com/hcX2OUU
So the story editor is only recognizing images with the trailing slash in the img tag. But none of my images in the gl_stories database have that trailing slash.
I tried disabling all of the extra plugins, this didn't change the behavior.
I am wondering if something missed during my database upgrade, or maybe there is a problem in the story.php code and it shouldn't actually be needing that slash?
I would rather not bulk-update all reference to images in my database if a better fix is available in some other way (e.g. something in story.php or the underlying bits).
Thanks!
- Dan Stoner
If I create a new story with an image, I can edit the story and the image tags appear correctly.
I tracked this down to minor difference in the database but I'm not sure of the proper corrective approach.
On existing stories, the gl_stories table images look like this:
Text Formatted Code
<img width="500" height="375" src="http://thatlinuxbox.com/blog/images/articles/20080120213334314_1.JPG" alt="">
On new stories, the gl_stories table images look like this:
Text Formatted Code
<img width="600" height="450" src="http://thatlinuxbox.com/blog/images/articles/2013091714351166_1.jpg" alt="" />
Notice that the newly created stories have a trailing slash just before the img closing tag.
This is what the editor looks like for older stories. Instead of showing "[image1]" it shows the actual long URL:
http://imgur.com/hcX2OUU
So the story editor is only recognizing images with the trailing slash in the img tag. But none of my images in the gl_stories database have that trailing slash.
I tried disabling all of the extra plugins, this didn't change the behavior.
I am wondering if something missed during my database upgrade, or maybe there is a problem in the story.php code and it shouldn't actually be needing that slash?
I would rather not bulk-update all reference to images in my database if a better fix is available in some other way (e.g. something in story.php or the underlying bits).
Thanks!
- Dan Stoner
7
9
Quote
Status: offline
thatlinuxbox
Forum User
Newbie
Registered: 09/04/13
Posts: 14
Location:Gainesville, FL
I think I found in lib-common where the slash is being added:
/**
* ensure XHTML constant is defined to avoid problems elsewhere
*/
if (! defined('XHTML')) {
switch ($_CONF['doctype']) {
case 'xhtml10transitional':
case 'xhtml10strict':
case 'xhtml5':
define('XHTML', ' /');
break;
default:
/**
* @ignore
*/
define('XHTML', '');
break;
}
}
Still not sure of the best path forward since I want to move to newer / responsive themes.
- Dan Stoner
Text Formatted Code
/**
* ensure XHTML constant is defined to avoid problems elsewhere
*/
if (! defined('XHTML')) {
switch ($_CONF['doctype']) {
case 'xhtml10transitional':
case 'xhtml10strict':
case 'xhtml5':
define('XHTML', ' /');
break;
default:
/**
* @ignore
*/
define('XHTML', '');
break;
}
}
Still not sure of the best path forward since I want to move to newer / responsive themes.
- Dan Stoner
12
10
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
It sound like you are using a new theme like Modern Curve. The doc type for it is XHTML 1.0 Strict which requires the / in certain tags to make it complient. Your old theme was probably HTML 4 which does not.
I ran into a similar issue where to make the theme compliant I had to convert all of the line break tags into
<br/>
Along with the hr tags, etc...
It is a real pain in the butt. I put a feature request in for us to allow template variables in stories, staticpages, etc. anything with html that could auto convert these on the fly. I guess a simple autotag could work here as well.
What we really need though is a script similar to the one I created here that someone can run that converts everything at once.
One of the Geeklog Core Developers.
I ran into a similar issue where to make the theme compliant I had to convert all of the line break tags into
Text Formatted Code
<br/>
Along with the hr tags, etc...
It is a real pain in the butt. I put a feature request in for us to allow template variables in stories, staticpages, etc. anything with html that could auto convert these on the fly. I guess a simple autotag could work here as well.
What we really need though is a script similar to the one I created here that someone can run that converts everything at once.
One of the Geeklog Core Developers.
8
7
Quote
Status: offline
thatlinuxbox
Forum User
Newbie
Registered: 09/04/13
Posts: 14
Location:Gainesville, FL
Maybe an HTML5 doctype and theme would also solve this.
8
12
Quote
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
I believe there is that doctype already (unless I am thinking of the unreleased version of Geeklog 2.1.0).
The problem is for older sites or someone who is learning html as they go.
On one of my 10+ year old sites the html in the articles from back then wasn't the best
For older site the problem also happens when you change themes to a newer standard. were changing a 1000+ articles manually isn't really a viable option.
What we really need is a built in function that uses htmllawed or something that will convert all the HTML articles, comments and content from plugins that support it (with the ability to select only certain content to convert) into the correct version of html. This could result in a few display issues for a few things but it might be the right way to go.
One of the Geeklog Core Developers.
The problem is for older sites or someone who is learning html as they go.
On one of my 10+ year old sites the html in the articles from back then wasn't the best
![Wink Wink](https://www.geeklog.net/forum/image_set/pixel.gif)
For older site the problem also happens when you change themes to a newer standard. were changing a 1000+ articles manually isn't really a viable option.
What we really need is a built in function that uses htmllawed or something that will convert all the HTML articles, comments and content from plugins that support it (with the ability to select only certain content to convert) into the correct version of html. This could result in a few display issues for a few things but it might be the right way to go.
One of the Geeklog Core Developers.
8
9
Quote
All times are EDT. The time is now 01:23 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content