Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues
Author Message
kingjames
Hangin' Around



Joined: Sep 27, 2011
Posts: 33

PostPosted: Sun Nov 06, 2011 8:12 pm Reply with quote

I was wondering if there is a simple way to stop RN from adding a "<p>" to every news post I make. I had 13,000+ news posts on my site when I recently converted it to RN with no extra "<p>" system generated blank lines.

I would like it to remain this way if possible. Right now I am going into CP everyday and removing the "<p>" but that doesn't seem like a very good long term solution any help would be appreciated.


Last edited by kingjames on Tue Nov 08, 2011 6:07 am; edited 1 time in total 
View user's profile Send private message
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Mon Nov 07, 2011 6:33 am Reply with quote

The <p> is added for compliance reasons in the nukeWYSIWYG editor. You could remove the extra space using css.

To your themes style.css, add this:

Code:


p + p { margin-top: 0.5em; }


If that doesn't work, try this:

Code:


p { margin-top: 0.5em; }

_________________
Tricked Out News 
View user's profile Send private message Send e-mail Visit poster's website
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Mon Nov 07, 2011 8:36 am Reply with quote

I have a custom module where I don't want the p tags included. As Nuken indicates, the WYSIWYG editor inserts them for compliance reasons. What I do is, in my database insert program I have this code:

Code:
$ride_description = check_html($_POST['ride_description'], '');

$ride_description = eregi_replace('<p>','', $ride_description);
$ride_description = eregi_replace('</p>','', $ride_description);


Where $ride_description is the text field I am inserting into the database. All p tags will get stripped.

To implement this in NEWS, you'd have to look at the code and put the hack in before the text is saved. I believe there are several functions in news/admin/index.php that actually save story text so you'd need to hack all of these looking at variables such as $hometext and $bodytext. Then of course when an upgrade to the software comes out you'd have to apply your hacks to that.
 
View user's profile Send private message Visit poster's website
kingjames







PostPosted: Mon Nov 07, 2011 10:00 pm Reply with quote

Thanks for the replies, nuken either Neither of your code snippets seem to be working for me, but that very easily may be because I am doing something wrong.

For instance does it matter where in the style.css I add the code? I just pasted it at the top of the page does it need to be somewhere else in the page?

If I understand correctly what the code addition in the style.css aims to do it is to remove the spacing issues, while still leaving the <p> in the posts. I guess this would be an acceptable compromise.

I really am shocked that this isn't an issue for more people, I mean if I post a short news post say two lines worth, and the <p> causes an extra space to go at the start and the end of my news post then the amount of line spacing looks to be nearly equal to the amount of actual text space this is IMO not an optimal condition.
 
kingjames







PostPosted: Mon Nov 07, 2011 10:07 pm Reply with quote

As for your response fkelly that really sounds quite complicated for a RN beginner like myself, nonetheless it may be something I have to consider anyway if I can't find a simpler solution. I am also curios what complaisance issue is the <p> required for anyway? Or is this something else that is going to be difficult to explain?
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Tue Nov 08, 2011 2:47 am Reply with quote

The editor allows you to create quite complex layouts, including extra DIV elements, tables etc and even has built in templates. The only sure way we know of to make sure the end result validates to W3C standards is to ensure text is held with a block level element (P - paragraph).

If there is too much whitespace surrounding your text then you should be able to alter than fairly easily in your CSS file but keep in mind that News is really intended for just that, News articles, not a line or two of text, though of course, everyone has different needs, hence the ability to adjust the styling to suit your needs.

You might also be able to remove the P element by hitting the 'source' button in the editor toolbar and removing them manually before saving - I'm not sure if the editor tries to put them back in or not.
Annoyingly though, when you hit 'return' the editor does assume you mean to start a new paragraph (nothing unusual really since most software of this kind, including MS Word does the same) but if you need to stop that, use shift+enter to start a new line
 
View user's profile Send private message Send e-mail
kingjames







PostPosted: Tue Nov 08, 2011 4:15 am Reply with quote

Thanks for the further explanations Guys. I just have one more question, what method is used to post news here at RavenPHPScripts then because it is actually quite similar to my own site, not all of my news post are two lines long but some of them are, just like there is one on the front page here right now that is.

I also did a search of the "view page source" that comes up when you right click on the browser and there is not one single <p> in the whole page that I can see. The spacing also looks dead on as well I guess because there is no <p>.

So are you using another method for posting news here other than the default editor? Guardian2003 thanks for the tip about the P element as soon as I finish this post then I am off to investigate it and see if I can get that to work. I will post back if it works.

Now don't get me wrong I don't want to be seen as disparaging the use of <p> in general as I use it in my articles and reviews quite often, and in that context where I am using paragraphs find it quite useful, but my news and in fact the news here on the front page of this site are not written in strict paragraph form and here the usage seems out of place IMO.
 
nuken







PostPosted: Tue Nov 08, 2011 4:36 am Reply with quote

Place the css at the bottom of the style.css. You could also try this:

Code:


p { margin-top: 0; }


and that should remove all the space at the top of the p.
 
kingjames







PostPosted: Tue Nov 08, 2011 4:40 am Reply with quote

Good news Guardian2003, your suggestion seems to have helped me find a workaround! Manually removing the <p> by using the 'source' button didn't seem to work for me, but what did work and I never would have found it without your input was editing my news post once I had made it and manually striping the <p> from there using the 'source' button. as you suggested This method is much easier than editing the table every day in CP and removing the <p>. Once again thanks guys for all your help with the customization.
 
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Tue Nov 08, 2011 8:40 am Reply with quote

One other note, the editor will not add <p> if you wrap your story in a <div> tag
Code:
<div>story text here</div>

although depending on on how much padding/margin your theme uses for <div> it could create similar issues, so you could try
Code:
<div class="monkeys">story text here</div>

then in your style css
Code:
.monkeys {margin:0;padding:0}


As far as adding CSS to your style.css, generally you would add at the bottom of the file, because if you add @ top it could likely be overridden by the style declarations that come after it. For instance:
Code:
p{margin:0}

p{margin:15px}

the first declaration would be ignored and all <p> would have a 15px margin
 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©