![]() |
Javascript blog problem.
Hi all,
Sorry to bother you. I have been really struggling understanding what is probably quite simple. I have been working on BlogSpot coding a theme. Currently, whenever a post is made, on the homepage it gets turned into a 'summary' rather than being shown as a full post. Below is the code which I have identified as handling the task. I have tried changing it and deleting it many times all resulting in the same result - The post is visible but none of the hyperlinked titles or post dates etc show, only the main content. I was hoping if someone could help me solve this so that when I post, a full article is shown on the blog rather than just a summary? PHP Code:
|
It makes sense except you haven't said what part of the post you want to *KEEP*.
That code is stripping out *ALL* HTML tags. Is that what you want? But the code is really really funky. Code:
if(img.length<=1) If img.length is *exactly* 1 (that is, if there is exactly 1 image within the <div>) then that code will first set imgtag to the one string and then to the other! And there is similar insanity with the if (postCount>=1) stuff.On top of that, the code to strip the HTML tags is braindead. It wouldn't give me much confidence in using this software. |
Just to show how UTTERLY BRAINDEAD that code is, try this:
Code:
var txt = "In math, 3 < 5 is true and 10 > 12 is false";You get an alert of In math, 3 12 is false The stupid code thinks that "< 5 is true and 10 >" is an HTML tag!!! ********* Anyway, aside from the code being both braindead and ugly as pig snot, if you don't want to eliminate HTML tags from the blogposts, then you *could* simply change that function to Code:
function removeHtmlTag( strx, chop ) { return strx; }Code:
function removeHtmlTag( strx, chop ) /* ignores chop! */ |
Do note that arbitrarily removing HTML tags can have funny consequences! (Using either their code or mine.)
For example: Code:
This is a nothing post. <span style="display: none;">This blog owner is a doofus</span>After removing the HTML tags, you get Code:
This is a nothing post. This blog owner is a doofusI think I would avoid BlogSpot if it doesn't support something like that! |
Thanks for all your help, it worked perfectly! Agreed, this code is very messy and doesn't help newbies at JS like me :D The BlogSpot platform the gives no option, they really need to update. They only recently started to allow people to code!
|
Gonna have to blow the dust off this one chaps...
The code now looks like this: PHP Code:
Whoever designed this clearly wants to make my life hell... All help appreciated muchly :D Joe |
are both of these supposed to be true? (they both are when img.length==1)
Code:
if (img.length <= 1) { |
| All times are GMT +1. The time now is 09:34 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.