henriksteen Posted April 15, 2006 Share Posted April 15, 2006 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 Link to comment https://forums.phpfreaks.com/topic/7481-a-smart-sidebar-an-ideathoughtchallenge/ Share on other sites More sharing options...
redbullmarky Posted April 15, 2006 Share Posted April 15, 2006 [!--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) [snapback]365085[/snapback][/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. Link to comment https://forums.phpfreaks.com/topic/7481-a-smart-sidebar-an-ideathoughtchallenge/#findComment-27270 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.