benmal Posted January 6, 2004 Share Posted January 6, 2004 I?m trying to create an infobox which displays the contents of a text file. The text file will contain a header, and the text body. The header of the file will contain something like the following: This is the title. After the heading there will be a blank line and then it will contain the text of the body, the text of the body could contain up to 500 words. I want the infobox to display the header and the text body, but for the text body it should only display 10 words of the text body. When the person clicks on the text body in the infobox it should display the full body text and header in the middle column of the website. Also the infobox should only be able to display the five most recent articles of the file in the infobox. I know this is simple, but how would you do it? Thanks for your help! :( Link to comment Share on other sites More sharing options...
benmal Posted January 6, 2004 Author Share Posted January 6, 2004 Would anyone have any idea? Thank-you! Link to comment Share on other sites More sharing options...
♥kymation Posted January 6, 2004 Share Posted January 6, 2004 I'll take a shot at this one. Go to the Contributions section and get this one. Copy one of the files from that, say conditions.php, and rename it whatever you want. Put a define in filenames.php to match the name of your new file. If you want your information in a box in the middle of the page instead of just text, use the text box from the instructions to the Contribution. Copy the HTML file as stated in the instructions. You can put your text in this file, either as plain text or with included HTML to make it look nicer. That takes care of the new page. For the box containing the link, make a new file and put this in it: <!-- new_box //--> <tr> <td> <?php $html_file = DIR_WS_LANGUAGES . $language . '/html/' . FILENAME_NEW_HTML_FILE; $html = implode("", file($html_file)); $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_NEW_BOX); new infoBoxHeading($info_box_contents, false, false); $info_box_contents = array(); $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_NEW_FILE) . '>' . strip_tags(substr($html, 0, 50)) . '.... </a>'); new infoBox($info_box_contents); ?> </td> </tr> <!-- new_box eof //--> That will pull in the first 50 characters from the same file that fills the page. I know that it's not going to break on word boundaries, but that's a bit harder. I haven't tested this, so caveat emptor. Regards Jim See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
benmal Posted January 6, 2004 Author Share Posted January 6, 2004 Thanks for that i will try that! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.