Gordonz Posted September 19, 2002 Share Posted September 19, 2002 I would like to include a page which has many HTML references on it [series of F. A. Q. where clicking on the question jumps to the answer further down the page ] I have written the HTML part but when I add it to the php file by using the php escape ie ?> HTML <?php the html part always appears at the top of the page above the boxes how do I get it to appear in the normal place? I did try including it within the php code but couldn't get that to work Please excuse my ignorance I'm a total newbie two php and have a very basic understanding of the HTML :( Link to comment Share on other sites More sharing options...
Guest Posted September 19, 2002 Share Posted September 19, 2002 If you go to oscdox.com it has a great tutorial on how to do what you are tring to do. Give that a shot first and let me know if you get stuck. --Gary Link to comment Share on other sites More sharing options...
Gordonz Posted September 19, 2002 Author Share Posted September 19, 2002 thanks Gary , I have looked for the tutorial , is it in the "installation and modification guide"? In my copy on page 33 headed "adding links outside of the boxes" talks about adding a fixed link at the bottom of one of the columns but this is not what I want to do as the links are on the page that I call up from one of the side boxes I had followed the tutorial on page 29 "adding blocks, links and new pages" where they create the page by copying shipping.php. This I did for several other pages which work but my F. A. Q. page doesn't because of the html links on it :cry: Link to comment Share on other sites More sharing options...
mattice Posted September 19, 2002 Share Posted September 19, 2002 The basic page build-up of oscommerce is simple: :arrow: header :arrow: left column :arrow: main body :arrow: right column :arrow: footer If you want to include a html file in the body section of *any* page you should search that page for the <body> tag. This is where the actual visual html output of the script starts. If you want to include html make sure it does NOT contain the <html> <head>blabla </head> <body blabla> stuff!! Make sure you understand html tables, that's whats shaping the osc pages. Quick lesson: <table> // starts a table <tr> // starts a table row <td> // starts a table cell </td> // closes cell </tr> //closes row </table> //closes table BTW you can ( and osC DOES ) nest tables. G'luck, Mattice[/code] "Politics is the art of preventing people from taking part in affairs which properly concern them" Link to comment Share on other sites More sharing options...
mattice Posted September 19, 2002 Share Posted September 19, 2002 Oh, and make sure you use the tep_href() function for your html links if you want to keep the customers's session_id. "Politics is the art of preventing people from taking part in affairs which properly concern them" Link to comment Share on other sites More sharing options...
Gordonz Posted September 19, 2002 Author Share Posted September 19, 2002 Thanks Matthijs, Will this give a fixed html output on every display of "main body"? What I want is a when a link named "FAQ" in one of the boxes is clicked then the FAQ's appear in the "main body". From my understanding these FAQ's need to be in a php file ( which I have named faq.php) When I include them as part of the file using " ?> html<?php " the html appears at the top of the " main body" above the osC banner instead of below the heading "Frequently Asked Questions" Link to comment Share on other sites More sharing options...
Guest Posted September 19, 2002 Share Posted September 19, 2002 This is the instuctions from OSDOX for what you are looking to do. There is some work involeved and the first time that you do it its a pain but after you see how its done its not so bad Adding Blocks, Links and New Pages : We will now look into adding our own custom boxes, as well as adding/changing links, pages and graphics to boxes. In addition, we will learn how to add items to the columns, outside of the actual boxes. All of these modifications are fairly easy to perform, but they are not entirely intuitive (understatement!). Let?s jump right in. The files involved are: /catalog/includes dir: column_left.php column_right.php /catalog/includes/boxes dir: ALL files in this directory Simply open information.php in a text editor and save as test.php. Then in column_left.php, add this line: require(DIR_WS_BOXES . 'test.php'); directly below this line: require(DIR_WS_BOXES . 'information.php'); Save column_left.php to your server, and reload the main catalog page. You will now see 2 information boxes on the left. The second one we just added with one line of code. That is the easy part. See the screenshot: The next step is to customize that box, and to do it, we need to modify a few more files. I want to change the title bar of our new box, as well as make links to new, custom pages that I will also create. This process is a bit more clunky than it should be, but we will have to make due. Here we go! The files and their paths are listed below: For this example, I will be creating four links to pages called testpage1.php, testpage2.php testpage3.php, and testpage4.php. in the new ?information? block we created on the main page. I am using the original shipping.php files as my base template. Use this example to get you started. The process is the same for other blocks, you just need to identify the proper files to copy and modify. Confused? Good. Read on? Now, I will explain step by step what you need to do. Open the following files in WordPad or some other text editor that will not modify code, and will allow you to search and replace: /catalog/includes/application_top.php /catalog/includes/languages/english.php /catalog/includes/languages/english/shipping.php /catalog/shipping.php /catalog/includes/boxes/test.php In the file /catalog/includes/application_top.php, find the section marked ?define filenames used in the project.? In this section, copy any one of the file definitions, and paste it to a new line, just after the one you copied. Now you need to modify the newly pasted line to point to ?testpage1? See the example below: Copy the first file definition listed: define('FILENAME_ACCOUNT', 'account.php'); Then paste this on a new line immediately following it. Create four new define statements as follows: define('FILENAME_TESTPAGE1', 'testpage1.php'); define('FILENAME_TESTPAGE2', 'testpage2.php'); define('FILENAME_TESTPAGE3', 'testpage3.php'); define('FILENAME_TESTPAGE4', 'testpage4.php'); Now, save /catalog/includes/application_top.php. This is the step that creates the filename definitions so that Oscommerce can build links. Next, in the file /catalog/includes/languages/english.php, find the section marked: information box text. Copy the entire section and paste it below the original section. Change the section to look like this. // information box text in includes/boxes/test.php define('BOX_HEADING_TEST', 'Test Box'); define('BOX_TEST_LINK1', 'Test Link 1'); define('BOX_TEST_LINK2', 'Test Link 2'); define('BOX_TEST_LINK3', 'Test Link 3'); define('BOX_TEST_LINK4', 'Test Link 4'); Save english.php. This step creates the link text that will go into each new link you create. In the file: /catalog/includes/languages/english/shipping.php edit the following: define('NAVBAR_TITLE', 'Shipping & Returns'); define('HEADING_TITLE', 'Shipping & Returns'); define('TEXT_INFORMATION', 'Enter your shipping info here'); To look like this: define('NAVBAR_TITLE', 'Test Page 1'); define('HEADING_TITLE', 'Test Page 1'); define('TEXT_INFORMATION', 'This is an added sample page'); Save as /catalog/includes/languages/english/testpage1.php Repeat this three more times, creating testpage2, 3, and 4. This is the step that actually creates the text that will be on each of your new pages, and in the process, creates 4 new files. In the file: /catalog/shipping.php using the replace feature of you text editor Replace this: FILENAME_SHIPPING With this: FILENAME_TESTPAGE1 Save As /catalog/testpage1.php Repeat this three more times, changing FILENAME_TESTPAGE1 to FILENAME_TESTPAGE2, 3 and 4 and saving as testpage2.php, 3 and 4. This step creates the actual pages that will be loaded by the links. Finally, edit the file /catalog/includes/boxes/test.php to look like this (changes are highlighted): <?php $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => BOX_HEADING_TEST ); new infoBoxHeading($info_box_contents, false, false); $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => '<a href="' . tep_href_link(FILENAME_TESTPAGE1, '', 'NONSSL') . '">' . BOX_TEST_LINK1 . '</a><br>' . '<a href="' . tep_href_link(FILENAME_TESTPAGE2, '', 'NONSSL') . '">' . BOX_TEST_LINK2 . '</a><br>' . '<a href="' . tep_href_link(FILENAME_TESTPAGE3, '', 'NONSSL') . '">' . BOX_TEST_LINK3 . '</a><br>' . '<a href="' . tep_href_link(FILENAME_TESTPAGE4, '', 'NONSSL') . '">' . BOX_TEST_LINK4 . '</a>' This changes the text that is output in the browser. You are finished editing files at this point. Make sure you upload the files to the proper directories, as some of them have the same filenames. View your catalog in your browser and the new links should show up, in your new block! See the picture to the left. Link to comment Share on other sites More sharing options...
Gordonz Posted September 19, 2002 Author Share Posted September 19, 2002 I was sent a ready made mod for a FAQ by the member Preeti so problem solved, thanks to this useful and very active forum.If anyone is interested I will send them the zip package The support I have received from this forum is fantastic compared to the support I received when I was setting up my present [commercial ] shopping cart where I had to often wait a week for assistance and months for any change to bugs! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.