TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 319
  • Total: 319

How Can I Print a BBC Article ?

Started by Gidget, May 23, 2008, 10:59:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Gidget

Hi everyone

I have searched but couldn't find any other posts related to my query.  I'm using SMF 1.1.4 with TinyPortal v1.0.5 beta 1.

I really like the new ability of TP v1.0.5 to print articles from a print icon on the article title bar, and this works wonderfully for HTML articles.

However, I have started to standardise writing new articles using BBC, partly because of this unsolved issue with FCKeditor and partly because HTML articles can be pesky to get "just right".  My old articles are all HTML and I don't really want to re-format them.

Using the print icon on the BBC articles, however, displays the page without parsing the BB code - I guess understandably as the print function expects an HTML article.

Since displaying the print icon is an "all or nothing" (global) article option, I can't just turn it off only on the BBC articles, and would prefer to have it available on all articles.

What I am hoping is that someone might help with some ideas/code to direct the print function to parse the BBC where necessary when printing articles.

Cheers

Gidget

IchBin

Not sure if this will work, but perhaps adding the BBC function to the print function would do it. Open TPortal.php and find this line:
else
$context['TPortal']['printbody'] = html_entity_decode($what);


Change it to this:
else
$context['TPortal']['printbody'] = html_entity_decode(doUBBC($what));


Gidget

Hi IchBin

You are the champ, of course  ;D

BB Code articles now parse beautifully with the print function - thank you  :up:

But (there always has to be a but, doesn't there?) I'm now getting a couple of weird effects when using the print function with HTML articles.  First, extra space is appearing wherever I have a paragraph break in an HTML article (with the effect that there is a lot of blank space between paragraphs etc).  The second funny effect is that while internal links to other pages on my website parse fine (as long as I use a relative reference and not the full URL in referencing them), links to external websites where I have to use the full URL don't parse properly.  It is like the beginning and end get chopped off by something.

Using an external link to Tiny Portal as an example, this is the code as entered in the HTML article:
<a href="http://www.tinyportal.co.uk">Tiny Portal</a>
When I click on the print icon, this is what appears on the new print page:
http://www.tinyportal.co.uk">Tiny Portal
It seems that the <a href=" at the start and the </a> at the end are getting "gobbled up" which is why the actual link doesn't appear on the print page like it used to (the links work fine on the print page for a BBC article though).

One other interesting observation; I have one HTML article which comprises an RSS feed from an external site with external links within the page - when I click the print icon for that particular article, it parses correctly with no extra spaces between paragraphs and no problems with external links displaying correctly  :o.

Any ideas?

Cheers

Gidget

IchBin

Sounds like its parsing line breaks different than HTML breaks. I can only suggest you compare the articles and figure out how to make them look the same in print.

This website is proudly hosted on Crocweb Cloud Website Hosting.