Author Topic: visitors to 4images pick template.  (Read 29310 times)

0 Members and 1 Guest are viewing this topic.

Offline uae

  • Newbie
  • *
  • Posts: 13
    • View Profile
visitors to 4images pick template.
« on: August 04, 2002, 07:50:54 AM »
Hi,

I've got more than one template, and I was wondering if I can have a link or a drop down list of all the templates I've got and let my visitors to 4images choose between templates.

Offline uae

  • Newbie
  • *
  • Posts: 13
    • View Profile
visitors to 4images pick template.
« Reply #1 on: August 05, 2002, 09:02:16 AM »
:D

Grrrr8 news, check this out, I've got this done I guess...

Now any visitor to your 4images can select between templates.


http://www.myuae.com/myalbum/


+++++++++++++

Offline dabri

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • http://www.12geschworene.de
visitors to 4images pick template.
« Reply #2 on: August 05, 2002, 09:40:57 AM »
Wow that is great, that´s what I need!

Can you post the instructions or the code, that I can realize this function in my gallery?

Thx & greets Daniel

Offline uae

  • Newbie
  • *
  • Posts: 13
    • View Profile
visitors to 4images pick template.
« Reply #3 on: August 05, 2002, 11:28:41 AM »
Here is what you need to do,

first,
find the following in the global.php

Code: [Select]
//-----------------------------------------------------
//--- Generate Setting --------------------------------
//-----------------------------------------------------
$sql = "SELECT setting_name, setting_value
        FROM ".SETTINGS_TABLE;
$result = $site_db->query($sql);
if (!$result) {
  echo $lang['no_settings'];
  exit;
}
while ($row = $site_db->fetch_array($result)) {
  $config[$row['setting_name']] = $row['setting_value'];
}
$site_db->free_result();


Then add the following

Code: [Select]
// registering global variable "user_template"

if (!isset($user_template))
   session_register("user_template");

// check global variable for Empty

 if ($user_template=="" || empty($user_template))
   $user_template = $config['template_dir'];


// set the Template if QueryString is not nothing
if (!empty($t) || $t != "")
 $user_template = $t;  

  $config['template_dir'] = $user_template;


it should look like this.

Code: [Select]
//-----------------------------------------------------
//--- Generate Setting --------------------------------
//-----------------------------------------------------
$sql = "SELECT setting_name, setting_value
        FROM ".SETTINGS_TABLE;
$result = $site_db->query($sql);
if (!$result) {
  echo $lang['no_settings'];
  exit;
}
while ($row = $site_db->fetch_array($result)) {
  $config[$row['setting_name']] = $row['setting_value'];
}

[b]// registering global variable "user_template"

if (!isset($user_template))
   session_register("user_template");

// check global variable for Empty

 if ($user_template=="" || empty($user_template))
   $user_template = $config['template_dir'];


// set the Template if QueryString is not nothing
if (!empty($t) || $t != "")
 $user_template = $t;  

  $config['template_dir'] = $user_template;
[/b]
$site_db->free_result();


The second thing, I've created a new php page with two forms of drop down list, one form was for the languages, and the other was for the templates, then I included this page to every template's header file.

This is the new php file I've created.

Code: [Select]
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="640" align="center">
  <tr>
    <form>
    <td width="50%" align="left">
    <select name="select_template" onChange="javascript:if(options[selectedIndex].value!='0') document.location.href=options[selectedIndex].value; ">
 <option value="0">Select a Template</option>
<?php
$t_link $_SERVER['QUERY_STRING'];
$t_link preg_replace("/&{0,1}l=[a-z\.]{1,25}/"""$t_link);
$t_link "?".$t_link;
$t_link $_SERVER['PHP_SELF'].$t_link."&t=";
  

$folderlist = array();
$handle opendir(ROOT_PATH."templates");

while ($folder = @readdir($handle)) {
  if (@is_dir(ROOT_PATH."templates/$folder") && $folder != "." && $folder != ".." && $folder != "_vti_cnf" ) {
    $folderlist[] = $folder;
  }
}
closedir($handle);
foreach ($folderlist as $folder) {
$templink $t_link.$folder;
?>

 <option value="<?php echo $templink; ?>"><? echo $folder ?></option>
             <?php
}
?>

</select>
   
    </td>
    </form>
    <form>
    <td width="50%" align="right">
    <select name="select_language" onChange="javascript:if(options[selectedIndex].value!='0') document.location.href=options[selectedIndex].value; ">
 <option value="0">Select a Language</option>

<?php
$l_link $_SERVER['QUERY_STRING'];
$l_link preg_replace("/&{0,1}l=[a-z\.]{1,25}/"""$l_link);
$l_link "?".$l_link;
$l_link $_SERVER['PHP_SELF'].$l_link."&l=";

$folderlist = array();
$handle opendir(ROOT_PATH."lang");
while ($folder = @readdir($handle)) {
  if (@is_dir(ROOT_PATH."lang/$folder") && $folder != "." && $folder != ".." && $folder != "_vti_cnf" ) {
    $folderlist[] = $folder;
  }
}
closedir($handle);
foreach ($folderlist as $folder) {
$langlink $l_link.$folder;
?>

 <option value="<?php echo $langlink; ?>"><? echo $folder ?></option>

             <?php
}
?>

   
    </td>
    </form>
  </tr>
</table>



Please do report bugs to me.

Good Luck

Offline dabri

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • http://www.12geschworene.de
visitors to 4images pick template.
« Reply #4 on: August 14, 2002, 03:17:26 PM »
Hello,

I´ve tried to install your Mod to my gallery, but it dodn´t work. OK I´m an absolut beginner in PHP.

First I change the code in the global.php, then I create an new page, called choice.php wirh the two forms. Here is my first questuion:

In which folder must the choise.php? /4images or /4images/includes ??? I think here is my mistake!

Then I want to include the forms only in the member_editprofile.html I open the member_editpofile.html in the template folder und use the following code:

Code: [Select]
<?php 
include&#40;"http&#58;//www.papierbrinkmann.de/umleitung/4images/choice.php"&#41;; 
?>


Where is my fault? Have I something forgot?

Thanks & Greets

Daniel

Offline uae

  • Newbie
  • *
  • Posts: 13
    • View Profile
visitors to 4images pick template.
« Reply #5 on: August 15, 2002, 07:17:37 AM »
Hi there,

Sorry, I haven't mentioned this, but I have placed the php file with the forms under the templates dir.

in your case, 4images/templates/choise.php

Good Luck.

Offline dabri

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • http://www.12geschworene.de
visitors to 4images pick template.
« Reply #6 on: August 15, 2002, 12:04:37 PM »
Hi uae,

I´ve change the global.php und copy the code for the forms in extra file called choice.php.

This file I´ve put in the template directory, but in the forms I can´t find the different template-styles or language!

Here is the url:

http://www.papierbrinkmann.de/umleitung/4images/templates/choice.php

Is my MySQL Version to old or where is the vault?

Greets Daniel

Offline teddy

  • Newbie
  • *
  • Posts: 43
    • View Profile
visitors to 4images pick template.
« Reply #7 on: November 25, 2002, 09:11:48 PM »
Hello,

where is the mistake? I see this:

Warning: open(/tmp\sess_932754823532583625, O_RDWR) failed: m (2) in g:\myserver\4images\global.php on line 141

and this for 3 times:

Warning: Cannot add header information - headers already sent by (output started at g:\myserver\4images\global.php:141) in g:\myserver\4images\includes\sessions.php on line 85

Line 141 in global.php= session_register("user_template");

Line 85 in sessions.php=  setcookie($cookie_name, $value, $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);

I can see the forms and select a template, it works. But what about the errors?

Can you help me?
Gruß Uwe
DigiCamTalk

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: visitors to 4images pick template.
« Reply #8 on: March 25, 2005, 02:40:37 PM »
Hi,

good smal and easy mod.  :P

I use it with links in my galley to change the styles !!

Th

Gruss
Kurt

Offline Tusnelda99

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: visitors to 4images pick template.
« Reply #9 on: August 22, 2006, 04:06:58 PM »
@ KurtW

did you use it at the moment on any homepage?? where we can visit it??

because i made this codechanges BUT the only thing i see is the select box with the text "Select a Template/ Language" ?!!!
No Folders/ templates to change?!!!

Please help?!!!

Thanks Tusnelda99

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: visitors to 4images pick template.
« Reply #10 on: August 22, 2006, 04:54:26 PM »
@ KurtW

did you use it at the moment on any homepage?? where we can visit it??

Hi Tusnelda99

no, i dont use this Mod yet.
I mad a update form my site and delete this option for Users:

But here was my code from the script:
Code: [Select]
<script language="JavaScript">
<!--
function goto_site() {
var selectedIndex = document.form1.to.selectedIndex;
if (selectedIndex > 0) {
var selection = document.form1.to.options[selectedIndex].value;
parent.location=selection;
}
}
//-->
</script>


<form method="post" action name="form1">
  <select name="to" size="1" onchange="goto_site();" class="button">
    <option selected value="0">Style ?</option>
    <option value="#">-------</option>
    <option value="http://your-domain/index.php?t=Nr.1">Style 1</option>
    <option value="http://your-domain/index.php?t=Nr.2">Style 2</option>
  </select>
</form>

You can put it for a test in templates/default/home.html under
Code: [Select]
{user_box}

But i dont now, it is work for Opera and Firefox...


cu
Kurt
« Last Edit: August 22, 2006, 05:10:54 PM by KurtW »

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: visitors to 4images pick template.
« Reply #11 on: May 16, 2008, 05:46:31 AM »
Hallo,

bei dir wird anscheinend  $t nicht übergeben..
Füge mal folgenden code in global.php ein
suche:
Code: [Select]
<?phpdanach einfügen:
Code: [Select]
    $t = (isset($HTTP_GET_VARS['t'])) ? intval(trim($HTTP_GET_VARS['t'])) : 0;  
- Wenn das nicht klappt, das gleiche mal in index.php

- Wenn das nicht klappt:
install mal eine neue Galerie, kannst ja die gleiche db verwenden.
Hier nochmals testen, egal, ob die thumbs und bilder angezeigt werden...

- Wenn das nicht klappt, dann bin ich auch am Ende mit meiner Weisheit...



Kurt
« Last Edit: May 16, 2008, 05:59:33 AM by KurtW »

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.289
    • View Profile
    • Discover the New World of Kindersurprise
Re: visitors to 4images pick template.
« Reply #12 on: July 18, 2008, 12:22:32 AM »
Hi Kurt,
Auf Wunsch einiger User, hab ich das mal in meiner Testumgebung eingebaut
Hab leider auch das Problem, das keine Änderung eintrifft

dein Tipp
Code: [Select]
$t = (isset($HTTP_GET_VARS['t'])) ? intval(trim($HTTP_GET_VARS['t'])) : 0;hab ich auch eingebaut, ebenfalls deinen Wechsler
http://ue-ei-portal-sammlerkatalog.de/katupdate
links unter den Kategorien Testhalber eingefügt, Style 1 sollte jetzt das default aufrufen
eigenartiger Weise kommt auch eine Fehlermeldung in der Sitemape
http://ue-ei-portal-sammlerkatalog.de/katupdate/sitemap_v2.php

Zeile 400 gehört zu der Modifikation
Code: [Select]
session_register("user_template");
hier mal die Änderung

Code: [Select]
//-----------------------------------------------------
//--- Generate Setting --------------------------------
//-----------------------------------------------------
$sql = "SELECT setting_name, setting_value
        FROM ".SETTINGS_TABLE;
$result = $site_db->query($sql);
if (!$result) {
  echo $lang['no_settings'];
  exit;
}
while ($row = $site_db->fetch_array($result)) {
  $config[$row['setting_name']] = $row['setting_value'];
}

// registering global variable "user_template"

if (!isset($user_template))
    session_register("user_template");

// check global variable for Empty

 if ($user_template=="" || empty($user_template))
   $user_template = $config['template_dir'];


// set the Template if QueryString is not nothing
if (!empty($t) || $t != "")
  $user_template = $t;   

  $config['template_dir'] = $user_template;

$site_db->free_result();

$config['allowed_mediatypes'] = str_replace(" ", "", $config['allowed_mediatypes']);
$config['allowed_mediatypes_array'] = explode(",", $config['allowed_mediatypes']);
$config['allowed_mediatypes_match'] = str_replace(",", "|", $config['allowed_mediatypes']);

$msg = "";
$clickstream = "";
define('MEDIA_PATH', ROOT_PATH.MEDIA_DIR);
define('THUMB_PATH', ROOT_PATH.THUMB_DIR);
define('MEDIA_TEMP_PATH', ROOT_PATH.MEDIA_TEMP_DIR);
define('THUMB_TEMP_PATH', ROOT_PATH.THUMB_TEMP_DIR);
define('TEMPLATE_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']);
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/".$config['template_dir']."/icons");

vielleicht machst Du da mal einen schönen Mod für die 1.7.6 raus, so mit Box  :wink:

LG. Harald


Danke Harald




Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
Re: visitors to 4images pick template.
« Reply #13 on: January 23, 2009, 03:40:48 AM »
it seem like this mood doesn't work in 4images v 1.7.6 [ i try already ]

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
Re: visitors to 4images pick template.
« Reply #14 on: January 23, 2009, 06:03:14 AM »
Ops sorry .. i'm wrong this mood can work only if register global is on ..in php