Page 1 of 1

Running imagevue.php with variables

Posted: 02 Apr 2011, 14:14
by Martin
I want to include imagevue.php from within index.php, but this time with some arguments.
Like this:
Code
<?php 
include_once("imagevue.php?language=english&theme=mabroEN");
?>
But this does not seem to work.

Neither is the following succesful:
Code
<?php 

$language = english;
$theme = mabroEN;
include_once('imagevue.php'); ?>
But this URL does work :
http://www.martinbroeze.nl/g1/imagevue. ... me=mabroEN

The reason for this all, is that I'm going to check the IP-address of a visitor, so I can branch to a dutch version of my website or to a english version.

And... by the way... using html files, like we discussed in the 'Multi lingual' topic does not work, because the html-website won't work anymore that way ..

The complete code of index.php, just for reference:
Code
<?
$IPaddress=$_SERVER['REMOTE_ADDR'];
$two_letter_country_code=iptocountry($IPaddress);

if ($two_letter_country_code=="NL"){
     include_once("imagevue.php?language=dutch&theme=mabroNL");
      die();
    }else{
     include_once("imagevue.php?language=english&theme=mabroEN");
      die();
    }

function iptocountry($ip) {   
    $numbers = preg_split( "/\./", $ip);   
    include("ip_files/".$numbers[0].".php");
    $code=($numbers[0] * 16777216) + ($numbers[1] * 65536) + ($numbers[2] * 256) + ($numbers[3]);   
    foreach($ranges as $key => $value){
        if($key<=$code){
            if($ranges[$key][0]>=$code){$two_letter_country_code=$ranges[$key][1];break;}
            }
    }
    if ($two_letter_country_code==""){$two_letter_country_code="unkown";}
    return $two_letter_country_code;
}
?>

martin

Re: Running imagevue.php with variables

Posted: 04 Apr 2011, 06:55
by mjau-mjau
You can't just "include" imagevue like that, especially not with variables like that.
mabro wrote:And... by the way... using html files, like we discussed in the 'Multi lingual' topic does not work, because the html-website won't work anymore that way ..
Not sure what you mean it doesn't work anymore that way. We have done it ourslves many time, and it is in fact how this works:
https://www.photo.gallery/demo/x2/index_example.html
mabro wrote:But this URL does work :
http://www.martinbroeze.nl/g1/imagevue. ... me=mabroEN
Yes, because that is just like writing /g1/?language=english&theme=mabroEN ... which is the same as we discussed in the language topic. This is URL parameters.

What you are trying to do makes no sense and it doesn't seem like you are a PHP coder either so I am not sure why you are making ti so difficult.

This won't work:
Code
include_once("imagevue.php?language=dutch&theme=mabroNL");
If you are going to use some code like this, then you should be simply editing the flashvars based on your condition. For example:
if ($two_letter_country_code=="NL"){
//set flashvars language = Dutch here
}

I am not a PHP coder myself, but I can see you are over-complicating things. What went wrong with the customization we had going on in the other topic?

Re: Running imagevue.php with variables

Posted: 04 Apr 2011, 07:33
by Martin
mjau-mjau wrote:...and it doesn't seem like you are a PHP coder either so...
Your're damn right :D
mjau-mjau wrote:What went wrong with the customization we had going on in the other topic?
I'll try to explain...
I've now got an index.php that either includes 'nl.html' or 'en.html' depending on the country-ip address.
Both these html-files I've adjusted like you mentioned in the 'Multi Lingual' topic.... so I added the language and the theme as flashvars.

My site starts with: http://www.martinbroeze.nl/g1/index.php
One of the html-file gets executed and it is also possible to switch between the languages my means of a menu-item link.
So everything seames to work just fine...

What confused me was this:
It is no longer possible to start the site as html-site... the following won't work anymore because it always starts the flash-version:
http://www.martinbroeze.nl/g1/?/content/

With this being so, I was afraid that google too would not be able to connect to the html-addresses.

Does this make any sense?

martin

Re: Running imagevue.php with variables

Posted: 04 Apr 2011, 07:56
by mjau-mjau
mabro wrote:What confused me was this:
It is no longer possible to start the site as html-site... the following won't work anymore because it always starts the flash-version:
http://www.martinbroeze.nl/g1/?/content/

With this being so, I was afraid that google too would not be able to connect to the html-addresses.
Unfortunately, when you start doing customizations and creating custom files, you loose the basics which Imagevue facilitates for you in its default form. By creating an index.html file, this file will take control over all access to the folder of the document by coming in line in front of index.php (which is used by imagevue with parameters to control where the gallery goes and how it works).

That's why my original suggestion was to go with "french.html" and perhaps not use "index.html". Instead you keep index.php for your original language.

Also, I am not quite sure where you are going with your PHP include. If I was you, I would simply edit iv-includes/templates/index.gallery.phtml. You can add your IP-check scripts, and also integrate them so that they apply a specific language and theme.

Re: Running imagevue.php with variables

Posted: 04 Apr 2011, 12:45
by Martin
mjau-mjau wrote:... I would simply edit iv-includes/templates/index.gallery.phtml. You can add your IP-check scripts, and also integrate them so that they apply a specific language and theme.
Yes... that did work!
I just had to figure out how to integrate it (being no PHP coder :) ) but it's a perfect solution...

The index.gallery.phtml now creates the right language and theme settings at startup depending on the ip-address of a visitor.
And switching languages can be done by menu-item links that run i.e. 'english.html' or 'dutch.html'

Thanks!

martin

Re: Running imagevue.php with variables

Posted: 04 Apr 2011, 14:55
by mjau-mjau
Nice! Maybe we will integrate something similar as an optional feature later on ...