Tip:
If you want a different index welcome page in each site you can do something like this.
File:includes/config_sites/sites_switch.php
after
$default_server_name = $_SERVER['HTTP_HOST'];
add
File:includes/modules/pages/index/header_php.phpPHP Code:
$default_server_name1 = 'www.site1.yoursite.com';
$default_server_name2 = 'www.site2.yoursite.com';
$default_server_name3 = 'www.site3.yoursite.com';
Line 42
from
toPHP Code:
$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_MAIN_PAGE, 'false');
You can edit then the page_1,page_2,page_3 from admin define pages editor.PHP Code:
if($_SERVER['HTTP_HOST'] == $default_server_name1 ){
$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_PAGE_1, 'false');
}elseif($_SERVER['HTTP_HOST'] == $default_server_name2 ){
$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_PAGE_2, 'false');
}elseif($_SERVER['HTTP_HOST'] == $default_server_name3 ){
$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_PAGE_3, 'false');
}else{
$define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_MAIN_PAGE, 'false');
}
Or you can specific other pages there from ez pages tool.
Hi Gerome,
I'm happy you liked my "MultiSite Module for Dummies" contribution. Here is another section for your documentation:
Consider how you will handle http 404 Not Found errors
As a good webmaster, you are never the source of a "page-not-found" error. You regularly use a link checker to verify that the linking structure of your web site is intact. You verify your web server log for 404 errors coming from external links pointing to non-existent pages on your site.
When the URL for a page needs to be corrected, you redirect requests for the old or incorrect location to the new location of the page. On the rare occasion when you just remove a page, you insert a "Page removed" page for human visitors that also gives a 410 "Gone" status to search engine spiders.
For good webmasters, "page-not-found" errors can only occur because someone typed in an incorrect URL into the address bar of their browser. Many sites intercept such errors using a 404 script. If your .htaccess file contains
the http404.php script will be executed for each request for a non-existent page.Code:ErrorDocument 404 /http404.php
Since you're now using the MultiSite module, you once again need to know what domain you're in so that you show the right "not-found" page. Here is an example of a http404.php script that handles the situation differently depending on the site:
There is some basic 404 error handling also in the Zen Cart. The basic format of a Zen Cart URL isCode:// http 404 not found error handler for multisite installations. // The http 404 status is already set here. // Just call the right page for the current site. switch($_SERVER['HTTP_HOST']) { case 'site1.com': require('http://site1.com/zencart/index.php?main_page=page_not_found'); break; case 'site2.com': require('http://site2.com/en/pages/not-found/'); break; case 'site3.com': require('http://site3.com/page-not-found.php'); break; } // Make sure that code below does not get executed when we redirect. exit;
If you use an incorrect <page> identifier, visitors will be redirected to a page-not-found page. In the sample http404.php script, any 404 error for site1.com is reflected back to the default page-not-found script in Zen Cart.Code:http://<domain>/<path>/index.php?main_page=<page>
However, Zen Cart does not automatically intercept any errors in the <domain> or <path> segments of the URL. That's why you need a separate 404 error script like the one described above.
Hi Stav,
I'm new here and I may be mistaken, but there is already a unique starting page pe r site at
Code:includes/languages/ENGLISH/SITENAME/index.php
(change the language and template name as required).
As long as your Zen Cart is in the root folder of your site, this will be the site-unique starting page for each site, thanks to the way the Zen Cart and the MultiSite Module works. If I'm incorrect, please let me know what situation your solution handles that isn't already supported by the default setup - as I said I'm really new here.
A special case is of course when the Zen Cart is NOT in the root folder of the site. Obviously, you cannot do anything in the Zen Cart to handle this situation, since it doesn't know about anything that happens outside it's own folders. Instead, you will have to use something similar to my PHP script above to show the right index page for each site.
That is the languages definitions for the index page,the most of the index texts content is stored in that page.
But if you go in admin/tools/define pages editor and there select from the dropdown menu the define_main_page.php.
Here you can specific anything on the top of the index page body content, you can use and WYSIWYG edotor in this page content.
In admin/tools/define pages editor are 4 empty pages too, page_1, page_2 , page_3 and page_4.
So i used that pages for each of my sites for main page contents welcome messages intro images etc.
Last edited by stav; 17 Aug 2007 at 12:48 PM.
I dont't know why you need different zencart_root/index.php pages for each site.
I think that you need just different text definitions for each site on the index page.
So you can do that if you put into languages/yourlanguage/name_of_the_site1_template/index.php
languages/yourlanguage/name_of_the_site2_template/index.php
languages/yourlanguage/name_of_the_site3_template/index.php
and then using my previous post for the define_main_page.php
You can have a totall diferents index or other pages for each site using diferrent template and languages definitions for each site.
The tip that I posted about define_main_page.php , is usefull that you can edit the define_main_page.php from the admin tool for all the sites, and you can changing that content anytime you like.
You can do the same thing using different laguage definitions files in
includes/languages/yourlanguage/html_includes/name_of_the_site1_template/define_main_page.php
includes/languages/yourlanguage/html_includes/name_of_the_site2_template/define_main_page.php
etc. but you must edit manualy that pages except the default define_main_page.php which you can edit from the admin defines pages editor.
You can Edit the file for each template from the admin section by changing the template from the admin section (this won't change the template front end) using Tools -> Templates Selection.
Using the Define pages is the best way of creating extra pages for the website and let the possibility to the admin to change the content...
Yeas right my mistake :).You can Edit the file for each template from the admin section by changing the template from the admin section (this won't change the template front end) using Tools -> Templates Selection.
Bookmarks