SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jul 2001
    Location
    mexico
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Help on code!!! >>

    Hi there, Im trying to use a multisite code so it can work different from each domain.
    Im using a postnuke module and I want to work for 2 modules, I need a code where when the people enters www.cualdebeser.com my code use a value "gallery" and when the people enter aguascalientes.cualdebeser.com the value be "gallery-aguas". Any Idea how can I do this;

    I think there has to be something like:

    if $HTTP_HOST www.cualdebeser.com then $value = "gallery"
    if $HTTP_HOST aguascalientes.cualdebeser.com then $value = "gallery-aguas"

    But since I dont know much about programming I need help on how to do this code correclty.

    THANKSSSS!!!!!
    Nunca dudes de tu capacidad!

  2. #2
    SitePoint Member
    Join Date
    Jul 2001
    Location
    mexico
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is the code that I want to edit:

    Code:
    	global $GALLERY_NO_SESSIONS;
    	global $GALLERY_BASEDIR;
    	global $GALLERY_EMBEDDED_INSIDE;
    	global $GALLERY_MODULENAME;
    	global $GALLERY_DIRE;
    	global $op;
    	global $mop;
    	global $include;
    	global $name;
    	$ModName = "GalleryCards";
    	$GALLERY_MODULENAME = "I WANT THE CHANGING VALUE HERE"; //Change this to your gallery  module Name
    	$GALLERY_BASEDIR = "modules/$GALLERY_MODULENAME/";
    	$GALLERY_EMBEDDED_INSIDE = "nuke";
    	$GALLERY_NO_SESSIONS = true;
    	$GALLERY_DIRE = "$HTTP_HOST/html";
    Nunca dudes de tu capacidad!

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2002
    Location
    Perth, Australia
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guiwells
    this is the code that I want to edit:

    Code:
    	global $GALLERY_NO_SESSIONS;
    	global $GALLERY_BASEDIR;
    	global $GALLERY_EMBEDDED_INSIDE;
    	global $GALLERY_MODULENAME;
    	global $GALLERY_DIRE;
    	global $op;
    	global $mop;
    	global $include;
    	global $name;
    	$ModName = "GalleryCards";
    	$GALLERY_MODULENAME = "I WANT THE CHANGING VALUE HERE"; //Change this to your gallery  module Name
    	$GALLERY_BASEDIR = "modules/$GALLERY_MODULENAME/";
    	$GALLERY_EMBEDDED_INSIDE = "nuke";
    	$GALLERY_NO_SESSIONS = true;
    	$GALLERY_DIRE = "$HTTP_HOST/html";

    Seeing as you're only checking for one of two possible values, you could do this:
    PHP Code:
    $GALLERY_MODULENAME $_SERVER['HTTP_HOST']=='www.cualdebeser.com' 'gallery' 'gallery-aguas'

  4. #4
    SitePoint Member
    Join Date
    Jul 2001
    Location
    mexico
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually I think I will use 4 subdomains for 4 cities, can I use that same code??

    by the way thanks for your help!
    Nunca dudes de tu capacidad!

  5. #5
    SitePoint Zealot
    Join Date
    Mar 2002
    Location
    Perth, Australia
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guiwells
    Actually I think I will use 4 subdomains for 4 cities, can I use that same code??

    by the way thanks for your help!
    No, but there are other options. You could use an elseif statement or a switch statement, which is what the example below uses.

    Add this function:
    PHP Code:
    function getGalModName(){
        switch(
    $_SERVER['HTTP_HOST']){
            case 
    'www.cualdebeser.com':
                return 
    'gallery';
                break;
            case 
    'aguascalientes.cualdebeser.com':
                return 
    'gallery-aguas';
                break;
            default:
                die(
    "<br /><br />Host name not found in function getGalModName<br /><br />");
        }

    Then $GALLERY_MODULENAME calls function getGalModName()
    PHP Code:
    $GALLERY_MODULENAME getGalModName(); 
    Just add a new case for each extra host name that you want to check for. More information on switch statements here:
    http://www.php.net/manual/en/control...res.switch.php

  6. #6
    SitePoint Member
    Join Date
    Jul 2001
    Location
    mexico
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That works just beautiful!!!

    Thanks a lot...
    Nunca dudes de tu capacidad!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •