[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squirrelmail-plugins
Subject:    Re: [SM-PLUGINS] q: fortune plugin with textwrap or <pre>-tag help
From:       "ferdie ferdsen" <mario.sm-plugins () despam ! de>
Date:       2004-09-29 2:37:19
Message-ID: 52102.80.185.190.201.1096425439.squirrel () m ! despam ! de
[Download RAW message or body]

> > i use the fortune plugin which is localted in the plugins/fortune
> > directory
> > 
> > now my "problem":
> > 
> > i have ascii-art fortunes and normal text fortunes, which i'd like to
> > have displayed with my fortune-plugin.
> > 
> > the problem is now, that the ascii-art is not showed properly, because
> > of more spaces are cutted down to one space. i.e. " a   s   c   i     i
> > "
> > will be "a s c i i"
> > 
> > so i inserted the html-code <pre> in the fortunes plugin but this shows
> > up the problem, that normal text fortunes cannot displayed properly,
> > because they not wraped at the screen-end of the browser. so the user
> > has to scroll, if he wants to read the fortune till end. (whis is lame,
> > if its a looooooong fortune)
> > 
> > 
> > there are a lot of php-extensions out in the web, which will wrap-text
> > to a user-defined nummer of columns, but that includes, that every
> > wraped textline has almost the same lenght, so it's not flexible when
> > users have different browser-windows-widths or display-properties. (i.e.
> > 800x600,
> > 1280x1024, etc)
> > 
> > 
> > 
> > i don't have any clue anymore. maybe some of you guys?


> 1. fortunes are preformated by default in 1.4.3a and 1.5.1cvs.

i do understand your words, but not how this is done by sm.

anyway:

> 2. use different formating for ascii art and normal quotes.

this does not work since all the "fortunes/ascii arts" are in one single
flat text file.

> 3. replace multiple spaces with &#32; or &nbsp; and set font style to
> monospace.

this does not work, because multiple &#32; are not shown as multiple
spaces in the browsers.

BUUUT you gave me a wonderful idea :-)

i replaced all spaces with &#160; and thought i got it, but then, the
browser didn't break the lines at the end of the screen. similar the
</pre> html-tag.

> 4. If your quotes contain 8bit iso-8859-1 symbols, use htmlentities
> instead of htmlspecialchars. If your quotes contain 8-bit utf-8 symbols
> recode('utf-8..html',$string) instead of htmlspecialchars

only god knows, whats in that fortune file... 8-)
and i'm not god.


with your help, i finaly get it to work:
the code now looks something like this:

$APO = shell_exec('/usr/local/bin/fortune');
$APO = htmlspecialchars($APO);
$APO = str_replace("  ", "&#160;&#160;", $APO);
$APO = str_replace(" ", "&#32;", $APO);
$APO= nl2br($APO);

printf("<p><div style=\"font-family:'Courier
New',Courier,monospace,sans-serif\">....

which means, that all multiple spaces are replaced with whitespaces
(&#160;), and normal/single spaces are replaced with normal spaces
(&#32;).

and if i read my words, i think, i could leave out the replacement " "
with &#32; ... so the code gets smaller

ok, thank you very much for your help!!

you offered my a good solution :-)

mario




-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
--
squirrelmail-plugins mailing list
Posting Guidelines: http://squirrelmail.org/wiki/wiki.php?MailingListPostingGuidelines
 List Address: squirrelmail-plugins@lists.sourceforge.net
List Archives: http://news.gmane.org/thread.php?groupList Archives: \
http://sourceforge.net/mailarchive/forum.php?forum_id931 List Info: \
https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic