Jump to content


Photo

A smart sidebar - an idea/thought/challenge?


  • Please log in to reply
1 reply to this topic

#1 henriksteen

henriksteen
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 15 April 2006 - 02:41 PM

Hello. Pardon my english, it's bad (i'm a norwegian) and my PHP-skills are even worse, and I admit that i have not read every 7614 topics to see if this already is covered somewhere, but I got this idea/thought/question (when I started reading PHP this holiday!) of a solution I think very many would love.

So, maybe this is a challenge for you clever PHP-freaks or maybe it's elementary for all I would know; is there a simple code/script/solution for this scenario: In the web there is a "sidebar"-folder that holds a collection of small "includes", sidebar1.inc sidebar2.inc sidebar3.inc etc. etc., each one are simple text/markup of two, five or ten lines, maybe a small picture.

If the web-page called for is very short, the page/code will include one or two elements (sidebar1.inc, sidebar2.inc..). If the web-page is a longer article, the code would somehow "see" the length and add more sidebar-elements (...sidebar3 .. " 4 " 5 - .. sidebar7.inc etc.) as long as it's space in the sidebar...!? Of course, not 100% precise. But you grasp the idea?

Well, I go back to page 44 in the PHP-bible and read on (I'm slow, but I try!), and then I return here with great excitement in a couple of days...

Sincerely,
Henrik, Oslo, Norway


#2 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 15 April 2006 - 03:56 PM

[!--quoteo(post=365085:date=Apr 15 2006, 03:41 PM:name=Henrik Steen)--][div class=\'quotetop\']QUOTE(Henrik Steen @ Apr 15 2006, 03:41 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Hello. Pardon my english, it's bad (i'm a norwegian) and my PHP-skills are even worse, and I admit that i have not read every 7614 topics to see if this already is covered somewhere, but I got this idea/thought/question (when I started reading PHP this holiday!) of a solution I think very many would love.

So, maybe this is a challenge for you clever PHP-freaks or maybe it's elementary for all I would know; is there a simple code/script/solution for this scenario: In the web there is a "sidebar"-folder that holds a collection of small "includes", sidebar1.inc sidebar2.inc sidebar3.inc etc. etc., each one are simple text/markup of two, five or ten lines, maybe a small picture.

If the web-page called for is very short, the page/code will include one or two elements (sidebar1.inc, sidebar2.inc..). If the web-page is a longer article, the code would somehow "see" the length and add more sidebar-elements (...sidebar3 .. " 4 " 5 - .. sidebar7.inc etc.) as long as it's space in the sidebar...!? Of course, not 100% precise. But you grasp the idea?

Well, I go back to page 44 in the PHP-bible and read on (I'm slow, but I try!), and then I return here with great excitement in a couple of days...

Sincerely,
Henrik, Oslo, Norway
[/quote]

hmmm. apart from using php to 'guess' based on a function that could count the approx number of lines in an article, the only way to get this accurate is via javascript (as you can read table/div heights after they have been drawn/show all the sitebars and hide the unncessary ones, etc).
the easiest way IMO would be to have a function to make an estimate of how many lines an article takes, and then go from there.

"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users