Vous êtes sur la page 1sur 5

How to make Joomla! multisite without any third extension http://new.anezi.

net/fr/
This tuturial for help you to have only one joomla folder installation for many websites. 1- Choose one folder for joomla files: In your Control Panel (CPanel), enter to Filemanager and create one folder to be used in all your websites: In this tuturial I call it joomla. Unzip the Joomla files in this folder /joomla 2- defines.php Create this file /joomla/defines.php
<?php // No direct access. defined('_JEXEC') or die; define('JPATH_BASE', dirname(__FILE__)); $parts = explode(DS, JPATH_BASE); //Defines. define('JPATH_ROOT',implode(DS, $parts)); include_once dirname(__FILE__) . '/configuration/sites.php'; $host = $_SERVER['HTTP_HOST']; $site = $sites[$host]; define('JPATH_SITE',JPATH_ROOT); define('JPATH_CONFIGURATION',JPATH_ROOT . '/configuration/'.$site); define('JPATH_ADMINISTRATOR',JPATH_ROOT.DS.'administrator'); define('JPATH_LIBRARIES',JPATH_ROOT.DS.'libraries'); define('JPATH_PLUGINS',JPATH_ROOT.DS.'plugins' ); define('JPATH_INSTALLATION',JPATH_ROOT.DS.'installation'); define('JPATH_THEMES',JPATH_BASE.DS.'templates'); define('JPATH_CACHE',JPATH_BASE.DS.'cache'); define('JPATH_MANIFESTS',JPATH_ADMINISTRATOR.DS.'manifests'); define('_JDEFINES', 'anezi');

3- Configuration folder Create this folder /joomla/configuration This folder will contain the configuration file for each website. Create a folder for each website. Here I have two websites, so I need two folders: /joomla/configuration/promotionsociale.com /joomla/configuration/new.anezi.net 4- Configuration file You need to create a configuration file for each website, here I need two files:

/joomla/configuration/promotionsociale.com/configuration.php /joomla/configuration/new.anezi.net/configuration.php Each one contains:


<?php class JConfig { public $offline = \"0\"; public $offline_message = \"OFFLINE MESSAGE\"; public $sitename = \"THE NAME OF THE WEBSITE\"; public $editor = \"tinymce\"; public $list_limit = \"25\"; public $access = \"1\"; public $debug = \"0\"; public $debug_lang = \"0\"; public $dbtype = \"mysqli\"; // DATABASE TYPE public $host = \"DATABASE HOST NAME\"; public $user = \"DATABASE USERNAME\"; public $password = \"DATABASE PASSWORD\"; public $db = \"DATABASE NAME\"; public $dbprefix = \"jos_\"; // PREFIX public $live_site = \"\"; public $secret = \"9Xq1DBbaEfog7TmX\"; public $gzip = \"0\"; public $error_reporting = \"-1\"; public $helpurl = \"http://help.joomla.org/proxy/index.php?option=com_help&keyref=Help\". \"{major}{minor}:{keyref}\"; public $ftp_host = \"127.0.0.1\"; public $ftp_port = \"21\"; public $ftp_user = \"\"; public $ftp_pass = \"\"; public $ftp_root = \"\"; public $ftp_enable = \"0\"; public $offset = \"UTC\"; public $offset_user = \"UTC\"; public $mailer = \"mail\"; public $mailfrom = \"YOUR EMAIL\"; public $fromname = \"SITE NAME\"; public $sendmail = \"/usr/sbin/sendmail\"; public $smtpauth = \"0\"; public $smtpuser = \"SMTP USERNAME\"; public $smtppass = \"SMTP PASSWORD\"; public $smtphost = \"SMTP HOST\"; public $smtpsecure = \"none\"; public $smtpport = \"25\"; public $caching = \"0\"; public $cache_handler = \"file\"; public $cachetime = \"15\"; public $MetaDesc = \"SITE DESCRIPTION\"; public $MetaKeys = \"SITE KEYWORDS\"; public $MetaAuthor = \"1\"; public $sef = \"1\"; public $sef_rewrite = \"1\"; public $sef_suffix = \"0\"; public $unicodeslugs = \"1\"; public $feed_limit = \"10\"; public $log_path = \"PATH TO YOUR WEBSITE/joomla/logs\"; public $tmp_path = \"PATH TO YOUR WEBSITE/joomla/tmp\"; public $lifetime = \"15\"; public $session_handler = \"database\";

public $MetaRights = \"2011 All rights reserved\"; public $sitename_pagetitles = \"1\"; public $force_ssl = \"0\"; public $feed_email = \"author\"; public $cookie_domain = \"\"; public $cookie_path = \"\"; public $MetaTitle = \"1\"; }

You need to change the parameters for each web site. 5- Liste of web sites file You need to create a file which contains the list of host names of each web site: /joomla/configuration/sites.php In my case, this file contains:
<?php $sites["new.anezi.net"] = \"new.anezi.net\"; $sites["www.new.anezi.net"] = \"new.anezi.net\"; $sites["promotionsociale.com"] = \"promotionsociale.com\"; $sites["www.promotionsociale.com"] = \"promotionsociale.com\";

Each host name needs a line:


$sites[$HOST_NAME] = $folder_name;

After that you can use the same extensions, templates, modules, plugins for all your websites, and you can do updates easily. I used it for 6 websites. Enjoy it :) Framework del flautas http://www.nooku.org/partners.html http://gantry-framework.org/documentation/joomla/basics/key-features http://www.anahitapolis.com/download/anahita-shiraz-template http://blog.hycus.com/2011/08/10/top-10-things-you-should-not-share-on-social-networks/ http://www.bestofjoomla.com/component/option,com_bestoftemplate/Itemid,46/

Image Resize PHP http://blog.hycus.com/2011/11/02/image-resize-and-square-cropping-using-php/


function square_crop($src_image, $dest_image, $thumb_size = 200, $jpg_quality = 90) { // Get dimensions of existing image $image = getimagesize($src_image); // Check for valid dimensions if( $image[0] <= 0 || $image[1] <= 0 ) return false; // Determine format from MIME-Type $image['format'] = strtolower(preg_replace('/^.*?\//', '', $image['mime'])); // Import image switch( $image['format'] ) { case 'jpg': case 'jpeg': $image_data = imagecreatefromjpeg($src_image); break; case 'png': $image_data = imagecreatefrompng($src_image); break; case 'gif': $image_data = imagecreatefromgif($src_image); break; default: // Unsupported format return false; break; } // Verify import if( $image_data == false ) return false; // Calculate measurements if( $image[0] > $image[1] ) { // For landscape images $x_offset = ($image[0] - $image[1]) / 2; $y_offset = 0; $square_size = $image[0] - ($x_offset * 2); } else { // For portrait and square images $x_offset = 0; $y_offset = ($image[1] - $image[0]) / 2; $square_size = $image[1] - ($y_offset * 2); } // Resize and crop $canvas = imagecreatetruecolor($thumb_size, $thumb_size); if( imagecopyresampled($canvas, $image_data, 0, 0, $x_offset, $y_offset, $thumb_size, $thumb_size, $square_size, $square_size )) { // Create thumbnail switch( strtolower(preg_replace('/^.*\./', '', $dest_image)) ) { case 'jpg': case 'jpeg': return imagejpeg($canvas, $dest_image, $jpg_quality); break; case 'png': return imagepng($canvas, $dest_image); break; case 'gif': return imagegif($canvas, $dest_image); break; default: // Unsupported format return false; break; } } else { return false; }

} function minimizeimg($src_image, $dest_image, $newwidth = 200, $jpg_quality = 90) { // Get dimensions of existing image $image = getimagesize($src_image); // Check for valid dimensions if( $image[0] <= 0 || $image[1] <= 0 ) return false; // Determine format from MIME-Type $image['format'] = strtolower(preg_replace('/^.*?\//', '', $image['mime'])); // Import image switch( $image['format'] ) { case 'jpg': case 'jpeg': $image_data = imagecreatefromjpeg($src_image); break; case 'png': $image_data = imagecreatefrompng($src_image); break; case 'gif': $image_data = imagecreatefromgif($src_image); break; default: // Unsupported format return false; break; } // Verify import if( $image_data == false ) return false; // Calculate measurements list($width,$height)=getimagesize($src_image); if($width > $newwidth){ $newheight=($height/$width)*$newwidth; }else{ $newwidth = $width; $newheight = $height; } // Resize and crop $canvas = imagecreatetruecolor($newwidth, $newheight); if( imagecopyresampled($canvas, $image_data, 0, 0, 0, 0, $newwidth, $newheight, $width, $height )) { // Create thumbnail switch( strtolower(preg_replace('/^.*\./', '', $dest_image)) ) { case 'jpg': case 'jpeg': return imagejpeg($canvas, $dest_image, $jpg_quality); break; case 'png': return imagepng($canvas, $dest_image); break; case 'gif': return imagegif($canvas, $dest_image); break; default: // Unsupported format return false; break; } } else { return false; } }

Vous aimerez peut-être aussi