Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / New format for Index Page

New format for Index Page

Locked

Views: 7,396

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
11 Oct 2007, 11:31 AM
#1
poldy avatar

poldy

New Zenner

Join Date:
Jul 2007
Posts:
5
Plugin Contributions:
0

New format for Index Page

Hi,
I need some help please
I would like my Index Page to have a different Layout.

  1. Welcome Guest! Would you like to.......
  2. Some Text - This is now (define_main_page.php)
  3. New Products
  4. Some More Text
  5. Featured Products
  6. Even More Text
    I probably need more then one define_main_Page.php.

I don't know where to start. I'd appreciate any help.
Thank you

11 Oct 2007, 11:49 AM
#2
carolight avatar

carolight

New Zenner

Join Date:
Aug 2007
Posts:
27
Plugin Contributions:
0

Re: New format for Index Page

I think you will have to use your php skills - you could try looking at the file:

includes/templates/YOUR_TEMPLATE/templates/tpl_index_default.php

11 Oct 2007, 11:53 AM
#3
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: New format for Index Page

I havent tried it myself , so you may need some more input , but I believe you could :

look at the file tpl_index_default.php

find the line

<div id="indexDefaultMainContent" class="content"><?php require($define_page); ?></div> 

and copy and paste it further down that page between the New and featured ( the page is well commented )

change the require bit to <?php require($define_page2)

then look at the file :

includes/modules/pages/index/header_php.php

Line #42 : $define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_MAIN_PAGE, 'false');  

and copy and paste again and change the start to the same as you called the other define ($define_page2) also FILENAME_DEFINE_MAIN_PAGE2

so

$define_page2 = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_MAIN_PAGE2, 'false');  

then define the page name in ../includes/filenames.php

define('FILENAME_DEFINE_MAIN_PAGE2', 'define_main_page2'); 

then place the file you want included in the html_include dir.

as I said I HAVE NOT TESTED THIS - BACKUP FIRST ! :unsure:

11 Oct 2007, 12:42 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: New format for Index Page

Or if you're not using your existing define_page_2 and define_page_3, perhaps you could just require those in tpl_index_default.php?

  • Maybe not... I haven't studied how that works and don't have any time right now. Look at how other define page files are required - that may show you how to phrase it...
21 Oct 2007, 4:36 AM
#5
tot_2_teen avatar

tot_2_teen

New Zenner

Join Date:
Oct 2007
Posts:
26
Plugin Contributions:
0

Re: New format for Index Page

Now you've lost me. When you say, "then place the file you want included in the html_include dir. ", where exactly are you talkig about? Or should I say what are you referring to? Also, where would you be able to edit/add the text I want to add?

Thanks for your help!

21 Oct 2007, 5:20 AM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: New format for Index Page

The directions in post 3 refer to making a new define_main_page2.php file, which is where you would add the extra text, and it would be saved in the /html_includes/ folder.

21 Oct 2007, 7:01 AM
#7
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: New format for Index Page

ghj42 is correct , sorry if i was not clear enough. :blush:

one way would be to find your original define_main_page.php in your html_includes directory as mentioned above , copy it and name it as you have already defined earlier , so call it define_main_page2.php and save it in the same place /html_includes/

you may be able to edit the file in the wysiwyg editor built into the admin , but i prefer to edit the whole file in dreamweaver or kompozer as it gives me more control over it.

hope that is clearer for you .

21 Oct 2007, 7:22 AM
#8
poldy avatar

poldy

New Zenner

Join Date:
Jul 2007
Posts:
5
Plugin Contributions:
0

Re: New format for Index Page

Thank you,
This is the perfect solution.
Works for me,
Thanks again to everyone for help

poldy

21 Oct 2007, 6:10 PM
#9
tot_2_teen avatar

tot_2_teen

New Zenner

Join Date:
Oct 2007
Posts:
26
Plugin Contributions:
0

Re: New format for Index Page

I have added the new files and it shows in my admin as "define_main_page2.php", but it still isn't showing on my site. I'm thinking I am being really dense and not pasting some of the code in the right spot. Step #1 says to paste the code further down the page. I have tried to paste it everywhere! It doesn't show anywhere on the page, not even the wrong location.

Step #2 doesn't specify where to paste the modified code, so I've pasted it directly below the original code. Is this right?

Finally, I have copied, modified and inserted the page in the html_include directory.

Would you be so kind as to showing me the code around where the new code should be pasted? I am trying to add a new section to the bottom of the catagories. My thoughts are if I can do this, it would be easy to duplicate all the steps again for the other areas.

Sorry to be so dense,

Sue

20 Nov 2007, 11:23 AM
#10
alibeoley avatar

alibeoley

New Zenner

Join Date:
Jan 2007
Posts:
9
Plugin Contributions:
0

Re: New format for Index Page

Sue, did you ever get this working? I'm trying to move the "New Products" box above the main page text, but not having much joy at the moment. As soon as I move the box, the main page text disappears!
Alison

20 Nov 2007, 11:51 AM
#11
tot_2_teen avatar

tot_2_teen

New Zenner

Join Date:
Oct 2007
Posts:
26
Plugin Contributions:
0

Re: New format for Index Page

Unfortunately, no. I got frustrated and went on to a new project. I couldn't get the box to appear on the index page. Can you tell me how you got that far and then maybe I can come upwith a solution for both of us!
Sue

20 Nov 2007, 12:03 PM
#12
alibeoley avatar

alibeoley

New Zenner

Join Date:
Jan 2007
Posts:
9
Plugin Contributions:
0

Re: New format for Index Page

I opened up tpl_index_default and moved the section for the New Products box above the section for the main text, but it's obviously not as straightforward as that. I don't know php very well, so everything i do is trial and error and rummaging around in the forums :smile:. It's a good way of learning, but I've been at it all morning and am absolutely no further along the simple task of moving the new products box above the main writing. It can get frustrating at times!

20 Nov 2007, 5:38 PM
#13
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: New format for Index Page

You need to pay close attention to exactly where you move a code block to. Putting it in the middle of something else, or too far up so that it is outside a div it should be in, will cause problems. Also make sure you are moving the whole relevant block and nothing extra.

As long as you do that right, you should be able to move the code ok.

5 Dec 2007, 11:35 PM
#14
rogue_tiger avatar

rogue_tiger

New Zenner

Join Date:
Aug 2007
Posts:
38
Plugin Contributions:
0

Re: New format for Index Page

Hey there - I tried this with my Index page and it works great! However, I am trying to apply the same technique to my "About Us" page and coming up with this error:

Warning: main(includes/languages/english/html_includes/FILENAME_DEFINE_ABOUT_US2.php) [function.main]: failed to open stream: No such file or directory in /homepages/36/d173658644/htdocs/babylonink/store/includes/templates/babylon_template/templates/tpl_about_us_default.php on line 56

Fatal error: main() [function.require]: Failed opening required 'includes/languages/english/html_includes/FILENAME_DEFINE_ABOUT_US2.php' (include_path='.:/usr/local/lib/php') in /homepages/36/d173658644/htdocs/babylonink/store/includes/templates/babylon_template/templates/tpl_about_us_default.php on line 56

Any ideas? I've gone through 4 times and redid each step, but still no luck. :wacko:

Thanks!

6 Dec 2007, 9:59 AM
#15
crazycucumber avatar

crazycucumber

Zen Follower

Join Date:
Jan 2006
Posts:
403
Plugin Contributions:
0

Re: New format for Index Page

It looks like your defining the filename , your code is looking for a file called :-

/html_includes/FILENAME_DEFINE_ABOUT_US2.php

and not finding it.

I don't have an about us page , and cant see where its called from , but Step 2 would be different for this page.

so the part where I say : "then look at the file :

includes/modules/pages/index/header_php.php"

I believe this is only relevant for the index page , there should be an equivalent file for the About Us page.

hope that steers you towards a solution.

7 Dec 2007, 2:49 AM
#16
rogue_tiger avatar

rogue_tiger

New Zenner

Join Date:
Aug 2007
Posts:
38
Plugin Contributions:
0

Re: New format for Index Page

BINGO! You were right crazycucumber! I was missing defining the page in the extra filenames folder. Since the index is defined in filenames.php, but the about us is an add on, it was in a different location.

Thanks for your help!!