pglarsson Posted September 27, 2010 Posted September 27, 2010 Hi! First of all I am new to OSCommerce and not a php coder so finding a lot of useful help here on the forum! But I have not found anything to help me on this issue, not anything I clearly understand anyway ;-) I would like to add a large image to the main page and in the main text area. I am guessing I should do this in the english/index.php 'MAIN_TEXT', '', I tried adding a simple define('TEXT_MAIN', '<img src="/images/top.jpg">'); but when I tested this I just got a question mark as a result. I am also concerned that the image will start where the actual text started before, and I would like this image to start at the same hight as the two left and right columns start. Would appreciate any advice! /Paula
♥mdtaylorlrim Posted September 28, 2010 Posted September 28, 2010 Hi! First of all I am new to OSCommerce and not a php coder so finding a lot of useful help here on the forum! But I have not found anything to help me on this issue, not anything I clearly understand anyway ;-) I would like to add a large image to the main page and in the main text area. I am guessing I should do this in the english/index.php 'MAIN_TEXT', '', I tried adding a simple define('TEXT_MAIN', '<img src="/images/top.jpg">'); but when I tested this I just got a question mark as a result. I am also concerned that the image will start where the actual text started before, and I would like this image to start at the same hight as the two left and right columns start. Would appreciate any advice! /Paula Remove the / before the directory path to images. Putting the / there means to start at root (of the file system, not your store) and leaving the / off means to start from the current directory. My method is to replace the TEXT_MAIN with a call to a php file instead. That way I can edit the php file independently from the index.php so it is safer and easy to test before you make it live. Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...?
pglarsson Posted September 28, 2010 Author Posted September 28, 2010 Remove the / before the directory path to images. Putting the / there means to start at root (of the file system, not your store) and leaving the / off means to start from the current directory. My method is to replace the TEXT_MAIN with a call to a php file instead. That way I can edit the php file independently from the index.php so it is safer and easy to test before you make it live. Hi! Thank you for your reply! I will try taking away the / ... How do I make a 'call' to an independent php file? Could I not use CSS and make a style with my background image as the image I would like to use? Can I then make a call to an simple html page, or just add a style to the table that the MAIN_TEXT is situated in? Sorry, its just that I have no php experience! :-) /Paula
♥mdtaylorlrim Posted September 28, 2010 Posted September 28, 2010 Hi! Thank you for your reply! I will try taking away the / ... How do I make a 'call' to an independent php file? Could I not use CSS and make a style with my background image as the image I would like to use? Can I then make a call to an simple html page, or just add a style to the table that the MAIN_TEXT is situated in? Sorry, its just that I have no php experience! :-) /Paula include(path_to_file); A php file can be very simple. <?php // This is a php file ?> <img src="path_to_image"> Any html code can go in here. <? //end of file ?> Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...?
pglarsson Posted September 29, 2010 Author Posted September 29, 2010 Hi! Now you have lost me... where would i add the include(path_to_file);?I think this my main issue really, which files controls the tables and what is placed in the main text cell? Thank you for your time and help! /Paula
♥mdtaylorlrim Posted September 29, 2010 Posted September 29, 2010 Hi! Now you have lost me... where would i add the include(path_to_file);?I think this my main issue really, which files controls the tables and what is placed in the main text cell? Thank you for your time and help! /Paula You add the include('path_to_file'); wherever you want the contents to appear. In your case look in your root index.php Scroll almost to the bottom looking for a line that looks like this... } else { //default page What follows is what is displayed on the main page. Look for the words TEXT_MAIN That is where it displays the value of whatever you have in the variable TEXT_MAIN which is defined in your includes/languages/english/index.php file. Maybe you should start off with something easier... If you do not want to change code then osCommerce is probably not for you because even changing this is going to be editing php files. BUT, it is not that hard... it comes to you quickly. Open the includes/languages/english/index.php file in a text editor and look for the line: define(TEXT_MAIN, '...... What follows is what is displayed on the main page. The line syntax should look like this: define(TEXT_MAIN, 'This is the content.'); 'This is the content.' must start with a ' and end with a ' and any other ' in between will cause it to crash. However, you can tell the php processor to literally print the ' instead of interpreting the ' as an ending quote by using \' This is called escaping the quote. Remember that as it will be used often here. Start slow and simple and work up to more complex editing. Unfortunately, the first thing you should be doing it a little complex. Have you applied any of the security patches found in the Security forum? Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...?
pglarsson Posted September 29, 2010 Author Posted September 29, 2010 Thank you for your answer! Found the text you told me about, at least I have a clearer picture how things are linked up! I am all up for editing! Love finding the solution to a problem and to pick up a few bits of editing. As this is not a complicated site I don't need to do much editing in any case. Would just like to get this image into the right spot... which I didn't manage, so still have to ask you for a bit of help! I have added the code from the index.php here below. As you can see there is bit that I have made bold. As I want the image to be the very first thing, not a title, could I move this coding down. And could I then write the include('') here for the PHP file called top.php. If I would add this file to the same root folder that this index file is placed, would I call up this file by writing <?php includes('top.php'); ?> OR should I go to the english/index.php, go to the MAIN_TEXT,'' and add the path there. And if I have the file in that same folder would I write MAIN_TEXT,'<a href="top.php">'. Not sure about the coding part and rather than try it out a zillion times I rather ask you straight away! Thank you for all your help! // Paula <?php } else { // default page ?> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_default.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="main"><?php echo TEXT_MAIN; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"><?php echo tep_customer_greeting(); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td> </tr> <?php include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS); ?> </table></td> </tr> </table></td> <?php } ?>
♥mdtaylorlrim Posted September 29, 2010 Posted September 29, 2010 Not really. The hardest part about osCommerce to some is that there are <tables> all over the place, and spread between different php files. The <title> might be in one where the <tr> may be in a second, and the <td></td> may be in a third. Very confusing. So, in the code you have bolded you really cannot just move things down because although you see a complete table there, it is within the <TR> tags of another table. You need be very careful where you move things or even add things. So, while keeping a good backup someplace you can experiment all you want. Good luck Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.