4images Forum & Community

4images Modifications / Modifikationen => Templates & Styles (Requests & Discussions) => Topic started by: ch€ri{Bi}² on September 20, 2005, 01:42:49 AM

Title: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 20, 2005, 01:42:49 AM
Hello,

For all those who want to stop (like me) to juggle between several templates when  installing a mod, and also for those who want to propose to their guests the possibility of choosing the colour of the site which they visit, :idea: I make a small modification which allows site administrator to keep a unique  template (...thus I do not speak about already published mods allowing the visitors to choose between templates) while modifying its colours as the visitors will want.

You can see a demo here (http://patsgallery.free.fr/4images/) :  :arrow:  Choose a color in the left below random image and see how the color of the (same) template changes.


Last Update : 05 February 2006

- use the default style.css if user stylesheet is not present

v1.1(01 Oct 2005) :
- file send_design.php deleted
- no more javascript nor redirection
- rewrite of code : closer to 4images original code

v1.0(20 Sept 2005) :
- Fisrt release


Let's go for it!

>> 03 files to edit from 4images root (3 steps):

[change]/include/page_header.php
[change]/templates/<yourtemplate>/header.html
[change]/templates/<yourtemplate>/home.html

no new file  8)

First, backup your files.

------ Installation ------


STEP 1: (updated on 01 oct 2005)

open page_header.php
search :
Code: [Select]
//-----------------------------------------------------
//--- Category Dropdown -------------------------------
//-----------------------------------------------------

and add before:
Code: [Select]
//-------------------------------------------[ [MOD] multi-color site]
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";

if (isset($HTTP_POST_VARS['design'])) {
  $design = $HTTP_POST_VARS['design'];
 
  $site_sess->set_session_var("design", $design);
  $session_info['design'] = $design;

  $cookie_expire = time() + 60 * 60 * 24 * 90;
  setcookie($cookie_name.'design', serialize($design), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
 
} else {

  $design = isset($HTTP_COOKIE_VARS[$cookie_name.'design']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'design'])) : "css_blue";
  $site_sess->set_session_var("design", $design);
  $session_info['design'] = $design;
}


$multi_color="";
$list_css = array();
$dir_name = TEMPLATE_PATH;

if (is_dir($dir_name)) {
  $dir_path = opendir($dir_name);

  $ext=".css";
  $long_ext=strlen($ext);

  while ($file_name = readdir($dir_path)) {
    $long_file=strlen($file_name)-$long_ext;

    if ($file_name != "." && $file_name != ".." && (substr($file_name,$long_file,$long_ext)==$ext)) {
  $color = $file_name;
  $color = ereg_replace('.css', '', $color);
  $list_css[] = $color ;
    }
  }
}

//détermination de la feuille de style et du logo
  //$mycss = $design.'.css';
  $mycss = (in_array ($design, $list_css))? $design.'.css' : 'style.css';
  $mylogo = 'logo_'.$design.'.gif';
  //$frame_cat = 'cat_'.$design.'.gif'; // chamge this to whatever you need in your template but don't forget to register it in register_vars
 

$multi_color = "\n<form name=\"colorname\" method=\"post\" action=\"".$self_url."\"><select name=\"design\" >\n";
foreach ($list_css as $key => $val) {
    $multi_color .= "<option value=\"$val\"";
    if ($val == $design) {
      $multi_color .= " selected=\"selected\"";
    }
    $multi_color .= ">".$val."</option>\n";
}
 $multi_color .= "</select>\n
 <INPUT type=\"submit\" value=\"".$lang['go']."\" class=\"button\" name=\"submit\" />
 </form>\n";

  $site_template->register_vars(array(
"mycss" => $mycss,
"mylogo" => $mylogo,
"multi_color" => $multi_color
  ));
//-------------------------------------------[/[MOD] multi-color site]

Note : don't forget change the value of css_blue to your default style without the extension.


STEP 2:

open /templates/<yourtemplate>/header.html
search and comment this line:
Code: [Select]
<link rel="stylesheet" href="{template_url}/style.css" />

replace by:
Code: [Select]
<link rel="stylesheet" href="{template_url}/{mycss}" />


STEP 3:

open /templates/<yourtemplate>/home.html
add this code above random picture :
Code: [Select]
<!-- ---[ [MOD] multi-color site] --->
                    <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20" > <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />Color of site</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1" >
  <br>
  {multi_color}
      </td>
  </tr>
  <tr>
                      <td class="tablebgcolor" style="height:1px"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                   </tr>
                  </table>
<!-- ---[/[MOD] multi-color site] --->

------ END of Installation ------

Now you can try to copy any stylesheets ( 8) from other templates but don't forget to rename each stylesheet) in your unique template directory and let your guest choose a new color in your home page. their choice is recorded in a cookie. so if they keep it, they keep the color.

Note : to make it work correctly, your background images must be in the stylesheets (i mean : no hard-coded background pics  :wink:).

Greetings.
Title: Re: [HACK] Many More colors with only ONE template
Post by: Xyu BAM on September 20, 2005, 02:10:10 AM
oh wow! would be awsome!
nice
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on September 20, 2005, 02:26:36 AM
I like that alot!

one queston, does it store my choice anywhere? if i return tommorow will it be the same color i picked?

Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 20, 2005, 09:35:56 AM
one queston, does it store my choice anywhere? if i return tommorow will it be the same color i picked?

yes... cookies based! Keep the cookie to keep the color :wink:
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on September 20, 2005, 02:53:55 PM
one queston, does it store my choice anywhere? if i return tommorow will it be the same color i picked?

yes... cookies based! Keep the cookie to keep the color :wink:

 8) , cool thats what i wanted to hear , cant wait to see this mod  :mrgreen:
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on September 21, 2005, 04:46:58 PM
This topic probally would have got more responce in the Mods & Plugins (Requests & Discussions) section.

u have 3 votes for people that like the mod so far , is that enough ?  :mrgreen:
Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 21, 2005, 05:20:56 PM
I think that in end of week we shall have more answers... :roll:

well, it is not really a mod but a small modification that concerns only the template and the style.

Furthermore it seemed to me that we could not open any more of topic directly in the Mods & Plugins (Requests & Discussions) section...
Now I can, but it not the problem...I have to find time to work on the publication even if it is not very complicated.... coming soon! :wink:

Regards.
Title: Re: [HACK] Many More colors with only ONE template
Post by: Xyu BAM on September 22, 2005, 12:51:52 AM
by the way, in IE (and maybe in FF) you can swap stylesheets without refreshing the page, I think this would also be great addition to what you've done already ;)
Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 22, 2005, 01:06:00 AM
by the way, in IE (and maybe in FF) you can swap stylesheets without refreshing the page

huuumm!!!    :?: swap stylesheets without refreshing the page?  

Can you tell me more about this ?
Title: Re: [HACK] Many More colors with only ONE template
Post by: Xyu BAM on September 22, 2005, 01:12:08 AM
By using javascript:
http://www.howtocreate.co.uk/jslibs/htmlhigh/swapstyle.html
Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 22, 2005, 02:16:54 AM
 8) Oh yes, it is exactly the same thought! 

But  :?  in my modification, I use PHP codes ( :arrow: post on the server) to validate the user's right... i think it is not possible without refresh (or post).

But theoretically, yes, the code you indicate can be used to offer this service to all guests without controlling their rights  :wink:

Title: Re: [HACK] Many More colors with only ONE template
Post by: Xyu BAM on September 22, 2005, 02:39:22 AM
let me explain the theory a little bit:
You dont need to change anything in you php code, all you need to do is make a JS code that would swap the stylesheet and update the cookie. ;)
The POST feature that php code handle should stay as it is, for best browser compability, in case javascript code failed :)

The current stylesheet also should be registered as a template tag, so JS code would know which style is currently selected.
Obviously it might sounds easy in theory, I dont know JS at all, so dont know how all this works :D

Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 22, 2005, 06:17:07 PM
I tried this method ( :arrow: without refresh). it is very very interesting and it works  but  :(  it does not answer my expectations.

when you use stylesheets whith pictures (for example with:  background-image: url(images/navbar.gif); ), the change on HTML style works correctly but not on this type of element because the images will not have been loaded by the browser.
The solution would be to look for all the images in differents stylesheets and to load them by the browser in the opening of the page ...  :?  too much complicated!

To solve this problem, the only way (in my opinion) is to validate the new selected stylesheet by the server, which will involve a reloading of the entire page with the new style and all the images which correspond to the new style.

do not hesitate to say to me if there is a better solution  :wink:
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on September 27, 2005, 01:51:49 AM
Any updates?

sorry i know i'm impatient  :lol:
Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 28, 2005, 12:21:02 PM
i found a way to reduce the number of modifiied files...
still optimizing the code  :wink:
coming soon !
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on September 28, 2005, 02:32:31 PM
cool,

I found out how to do it using javascript , but that doesnt work for my needs as I need the page reresh to change the images called by the stye sheet.

so i will wait for cheribibi's code
Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 29, 2005, 01:11:50 AM
You can find the light version of the mod in the first thread of this topic.  :wink:

tell me if something is wrong.
 have fun! 8)
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on September 29, 2005, 03:04:06 AM
Well i have tried it twice and i get the same result


Notice: Undefined variable: color in C:\..\send_design.php on line 4

Warning: Cannot modify header information - headers already sent by (output started at C:\...\send_design.php:4) in C:\...\send_design.php on line 4


I hope this has nothing to do with this mod from Jan- [Mod] Different cat templates / Verschiedene Kategorie Templates- http://www.4homepages.de/forum/index.php?topic=1847.0
Title: Re: [HACK] Many More colors with only ONE template
Post by: V@no on September 29, 2005, 03:29:10 AM
in send_design.php line:
Code: [Select]
setcookie("4images_DESIGN","$color",time()+$expire); //enregistrement du cookie au nom de DESIGN repris dans design.php
should be changed to:
Code: [Select]
setcookie("4images_DESIGN",((isset($_POST['color']) && !empty($_POST['color'])) ? $_POST['color'] : ((isset($_GET['color']) && !empty($_GET['color'])) ? $_GET['color'] : "style")),time()+$expire); //enregistrement du cookie au nom de DESIGN repris dans design.php
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on September 29, 2005, 03:43:17 AM
in send_design.php line:
Code: [Select]
setcookie("4images_DESIGN","$color",time()+$expire); //enregistrement du cookie au nom de DESIGN repris dans design.php
should be changed to:
Code: [Select]
setcookie("4images_DESIGN",((isset($_POST['color']) && !empty($_POST['color'])) ? $_POST['color'] : ((isset($_GET['color']) && !empty($_GET['color'])) ? $_GET['color'] : "style")),time()+$expire); //enregistrement du cookie au nom de DESIGN repris dans design.php

That works to change the style sheet, but it gets hung up on send_design.php and doesnt go back to the refering page. after i hit back the sytle sheet has changed
Title: Re: [HACK] Many More colors with only ONE template
Post by: V@no on September 29, 2005, 04:04:18 AM
yeah, it require HTTP_REFFERER variable to be set, anyways, IMO using an external script for this metter is not such good idea. All cookie set should be done in global.php instead.
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on September 29, 2005, 04:15:31 AM
yeah, it require HTTP_REFFERER variable to be set, anyways, IMO using an external script for this metter is not such good idea. All cookie set should be done in global.php instead.

is that something u set in 4images or php itself?

How can this code be done in global.php ?

any help would be greatly appreciated

Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 29, 2005, 08:21:22 AM
hehe! when i said i was optimizing the codes...  :roll:

i think it will be a good thing to (delete and) include the code in send_design.php in some existing file (i don't know, why not page_header.php or another)...
so the switch could be called by : http://domain_name/4images/index.php?send_design=some_color

@impss : what browser do you use?
 :arrow: the code is tested with ie6 but i got problems with opera (redirect on HTTP_REFFERER don't work, i must refresh)
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on September 29, 2005, 02:11:08 PM
Im tested using both ie6 and firefox, same problem

I tested it on a new install also, same problem
Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 29, 2005, 05:59:33 PM
 :?: can you give a link to test your site (& your problem)? and what is your PHP version ?

because :
1 - i read somewhere the browser ou maybe a firewall can block  HTTP_REFFERER...
2 - some older version of PHP  got problems with getenv();
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on September 29, 2005, 06:19:29 PM
http://www.cusstom.com/4images/

PHP Version 4.3.8
Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 29, 2005, 08:06:53 PM
 :!: original post updated with correction from v@no  8)

yeah, it require HTTP_REFFERER variable to be set, anyways, IMO using an external script for this metter is not such good idea. All cookie set should be done in global.php instead.
@v@no, not sure to understand :
1 - what do you mean by IMO?
2 - and why all cookie set should be done in global.php : I did not see any cookie declared in my global.php file and i know that some mod uses cookies. is there a specific file where to declare the cookies?



@impss
you got this error on your page:
Quote
<b>Fatal error</b>:  Call to undefined function:  server() in <b>C:\CuSStom.com\www\4images\send_design.php</b> on line <b>7</b>
line 7 is about the page redirection (  :arrow: refresh )

so, forget JS : in send_design.php just comment the 2 lines with JS ,  and try to replace :
Quote
echo 'window.location="',getenv('HTTP_REFERER'),'"';
by
Code: [Select]
header("Location: ".$_SERVER['HTTP_REFERER']);

  :?:  can you tell me if the redirection works for you with this code?
Title: Re: [HACK] Many More colors with only ONE template
Post by: mawenzi on September 29, 2005, 09:19:33 PM
IMO - in my opinion ...  :wink:
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on September 29, 2005, 09:33:23 PM
cheribibi

If i understand you correctly, it should look like this now?
Code: [Select]
<?php
//-------------------------------------------[ [MOD PERSO] Site multi-couleurs] 
$expire=365*24*3600// 1 an - 1 year
setcookie("4images_DESIGN",((isset($_POST['color']) && !empty($_POST['color'])) ? $_POST['color'] : ((isset($_GET['color']) && !empty($_GET['color'])) ? $_GET['color'] : "style")),time()+$expire); //enregistrement du cookie au nom de DESIGN repris dans design.php
//echo "<script language=\"JavaScript\">\n";
//echo "alert('Nouvelle couleur de design sélectionnée : ".$color.". \\nN\'hésitez pas à rafraîchir la page si les couleurs n\'apparaissent pas.\\n---\\nNew selected colour : ".$color.". \\nPlease refresh the page if colours do not appear.');";
header("Location: ".$_SERVER['HTTP_REFERER']); //retour à la dernière page visitée du site avec les nouvelles couleurs
echo "</script>";
//-------------------------------------------[/[MOD PERSO] Site multi-couleurs] 
?>

With the code above , it does get redirected back. but with out making the changes.
Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 29, 2005, 10:13:21 PM
yes and the code above also works for me !!  :roll:

ok now just to debug, try this code in send_design.php :
Code: [Select]
<?php
//-------------------------------------------[ [MOD PERSO] Site multi-couleurs] 
$referer getenv('HTTP_REFERER');
echo 
$referer;
$expire=365*24*3600// 1 an - 1 year
setcookie("4images_DESIGN",((isset($_POST['color']) && !empty($_POST['color'])) ? $_POST['color'] : ((isset($_GET['color']) && !empty($_GET['color'])) ? $_GET['color'] : "style")),time()+$expire);
echo 
"<script language=\"JavaScript\">\n";
echo 
"alert('Nouvelle couleur de design sélectionnée : ".$color.". \\nN\'hésitez pas à rafraîchir la page si les couleurs n\'apparaissent pas.\\n---\\nNew selected colour : ".$color.". \\nPlease refresh the page if colours do not appear.');";
// echo 'window.location="'.getenv($_SERVER['HTTP_REFERER']).'"'; //retour à la dernière page visitée du site avec les nouvelles couleurs
// header("Location: ".$_SERVER['HTTP_REFERER']);
echo "</script>";
//-------------------------------------------[/[MOD PERSO] Site multi-couleurs] 
?>


as you can see, i comment out the redirection and asked for the display of the HTTP_REFERER
 :arrow: you should have a blanc page with your HTTP_REFERER
can you tell me what you see.
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on September 29, 2005, 10:19:15 PM
i get

http://www.cusstom.com/4images/
Warning: Cannot modify header information - headers already sent by (output started at C:\CuSStom.com\www\4images\send_design.php:4) in C:\CuSStom.com\www\4images\send_design.php on line 6

Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 29, 2005, 10:29:01 PM
all these codes works for me  :oops:
check that you let no space (or a new line) at the end of the file after ?>
Title: Re: [HACK] Many More colors with only ONE template
Post by: V@no on September 30, 2005, 12:05:23 AM
@v@no, not sure to understand :
1 - what do you mean by IMO?
2 - and why all cookie set should be done in global.php : I did not see any cookie declared in my global.php file and i know that some mod uses cookies. is there a specific file where to declare the cookies?
1)  IMO = In My Oppinion
2) global.php being executed by any 4images pages. That's why if you do all needed cookie set in global.php you can use $self_url in the form:
Code: [Select]
$multi_color = "\n<form name=\"colorname\" method=\"post\" action=\"".$self_url."\"><select name=\"color\" >\n";By doing that, it will "refresh" the current page no mwork on 9 pages out of 10. (some restrictions apply, such as $mode or such variable might not be avalable through $self_url)
Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on September 30, 2005, 12:23:36 AM
@all : thanks for your answers  8) I usually do not speak English and there are subtleties which I do not know

@ impss
it seems you got problems with paramters in the url  :?

try this 2 urls (COPY AND PASTE):
Quote
http://www.cusstom.com/4images/send_design.php?color=style
and after refresh your home page, style is applyed
then try:
Quote
http://www.cusstom.com/4images/send_design.php?color=style2
return to your home page and you will see the switch is working (style2 is applied) but still got JS errors (try to comment ALL lines with JS : everything should work with only PHP)

Note : I found why the code didn't work with my browser Opera   :arrow: there is a menu to enable/disable referrer logging  :wink:
Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on October 01, 2005, 02:01:14 AM
Major update of original code

since there were problems with send_design.php file, I removed it.

no regrets  :arrow:  all the corresponding code is in the page_header.php file and now the code of the MOD is closer to 4images original code 
no JS and no redirection 8)
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on October 01, 2005, 02:28:41 AM
Great job!!

Working Perfect now 8)

http://www.cusstom.com/4images/index.php

Now just gotta make come sytle sheets for my gallery

Thanks cheribibi, I appreciate the work!!  :D
Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on October 01, 2005, 02:37:22 AM
well don't forget change the following value  to your default style without the extension:
Quote
$design = isset($HTTP_COOKIE_VARS[$cookie_name.'design']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'design'])) : "css_blue";
css_blue is my default stylesheet without the extension.

without that the visitors will have no stylesheet with their first visit until they choose a new style  :roll:


have fun  :wink:
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on October 01, 2005, 02:42:07 AM
well don't forget change the following value  to your default style without the extension:
Quote
$design = isset($HTTP_COOKIE_VARS[$cookie_name.'design']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'design'])) : "css_blue";

without that the visitors will have no stylesheet with their first visit until they choose a new style  :roll:


have fun  :wink:

Yea i just did that, noticed it when i tested it out in Firefox and Opera
Thanks again
Title: Re: [HACK] Many More colors with only ONE template
Post by: JensF on November 07, 2005, 08:36:33 PM
Hello,

a Great Mod but i have one Problem. I have installed this Mod (Cache Mod (http://www.4homepages.de/forum/index.php?topic=8476.0)) and when i change the color i can´t see it. The cache is active.

Is there a way to clear the cache before change the color???

I mean, i change the color and before it where load the cache where cleared...


And now i have another Problem. When i disable the CAche Mod this Mod works but now for the start Page. When i click to a categorie i have my standard style...
Title: Re: [HACK] Many More colors with only ONE template
Post by: Acidgod on November 07, 2005, 09:35:39 PM
Quote
if (isset($HTTP_POST_VARS['design'])) {
  $design = $HTTP_POST_VARS['design'];
 
  $site_sess->set_session_var("design", $design);
  $session_info['design'] = $design;

  $cookie_expire = time() + 60 * 60 * 24 * 90;
  setcookie($cookie_name.'design', serialize($design), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);

   @set_time_limit(0);
   clear_cache();

}

Habe es nicht getestet aber versuche das doch mal...
Title: Re: [HACK] Many More colors with only ONE template
Post by: JensF on November 07, 2005, 09:47:10 PM
Hi,

vielen Dank. Scheint zu funktionieren. Cache ist wieder an und ich kann das Style ändern. Leider habe ich aber immer noch mein 2tes Problem und natürlich mal wieder keine Ahnung woran das liegt.

Und zwar kann ich das Style ändern und es wird mir dann auf der Startseite angezeigt. Klicke ich jetzt aber auf eine Kategorie oder ein Bild dann habe ich plötzlich wieder mein Standard Style. Und auch wenn ich dann wieder zur Startseite gehe ist wieder der Standard drin.

Kannst du da vielleicht auch helfen???


--------------------------------------------------------

My Problem. When i change the color i see the start page in the new color but when i click a categorie now i have the standard......
Title: Re: [HACK] Many More colors with only ONE template
Post by: Acidgod on November 07, 2005, 10:15:42 PM
Ich denke das ist ein Cookie Problem, haste die Cookie bei dir deaktiviert?
Title: Re: [HACK] Many More colors with only ONE template
Post by: JensF on November 07, 2005, 10:22:34 PM
Ich denke das ist ein Cookie Problem, haste die Cookie bei dir deaktiviert?

Ne, Cookies sind eigentlich aktiviert. Bleibe ja auch eingeloggt wenn ich die Seite neu aufrufe nachdem ich den Browser geschlossen habe.

Das komische ist das sich nun etwas geändert hat. Wenn ich zur Startseite zurückkehre dann habe ich immer noch mein eingestelltes Style. Nur wenn ich halt irgendwas anderes aufrufe wird mir wieder der Standard angezeigt.

Teste es doch bitte mal kurz. Seite ist http://www.terraristik-galerie.de . Dort kannst du das Style ändern und dann klicke mal eine Kategorie. Dann siehst du was ich meine. Und wenn du dann wieder zum Start zurückkehrst ist das ausgewählte Style wieder da...
Title: Re: [HACK] Many More colors with only ONE template
Post by: Acidgod on November 07, 2005, 10:33:29 PM
war das den auch schon der fall bevor wir das cache lerren eingebaut haben?
Title: Re: [HACK] Many More colors with only ONE template
Post by: JensF on November 07, 2005, 10:54:01 PM
war das den auch schon der fall bevor wir das cache lerren eingebaut haben?

Ja, da war das selbe Problem. Hatte die Cache Funktion ja auch mal deaktiviert und da war das dann auch.

Habe eben mal in meinem Cookie Ordner geschaut und wie es scheint wird doch kein Cookie angelegt.
Wenn ich den Code richtig verstehe sollte ja ein Cookie mit dem Namen 4images_ angelegt werden.

Code: [Select]
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
Allerdings habe ich keinen Cookie der mit 4images_ anfängt....
Title: Re: [HACK] Many More colors with only ONE template
Post by: Acidgod on November 07, 2005, 11:14:15 PM
also ich kwerde für heute schluss machen, wenn dir bis morgen niemand helfen konnt schaue ich nochmal...
Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on November 08, 2005, 03:01:10 AM
Allerdings habe ich keinen Cookie der mit 4images_ anfängt....
I do not speak this language   :oops:  but according to what I understood (and what I saw on your site),it does not work for you and you don't find the cookie...

this code:
Code: [Select]
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_"; checks if the name of the cookie were already defined. 
if it is true, the cookie will use this name ( => it's your case.)
if it is false, a new name (in this code 4images) is defined for a new the cookie.

 :arrow:  the problem is as follows:  when you refresh or load a new page, it is not possible to know which style to use in your page because the information about the style is not stored in your cookie(you should find in your cookie an item called 4images_design, but...no trace )... then default style is used.

 :?: can you reach the logs of your php server and if so, can you find errors about cookies creation (or writing) about the creation/update line?

Title: Re: [HACK] Many More colors with only ONE template
Post by: JensF on November 08, 2005, 03:09:33 PM
hhmm, i have nothing about an error of a cookie in my log file.... :(
Title: Re: [HACK] Many More colors with only ONE template
Post by: Acidgod on November 08, 2005, 03:54:27 PM
nicht in den access log schauen, du musst dann auch im error log schauen... (o:

Ist jetzt nur eine Vermutung...
Title: Re: [HACK] Many More colors with only ONE template
Post by: JensF on November 08, 2005, 09:18:51 PM
nicht in den access log schauen, du musst dann auch im error log schauen... (o:

Ist jetzt nur eine Vermutung...

Hab ich doch. Kann bei meinem Anbieter in Logfiles gehen und dann das laufende Error Logfile ansehen oder die letzten 10 Error Logs.

Wie müsste denn die Fehlermeldung ungefähr aussehen???
Title: Re: [HACK] Many More colors with only ONE template
Post by: JensF on November 09, 2005, 09:29:19 PM
hhmmm, no one can help me?!

I deinstall this Mod :(

Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on February 05, 2006, 02:32:40 AM
cheribibi

Say someone has selected a Color, and they have it saved in there cookie. And you want to get rid of that template.
They next time they comeback to the site, it will be messed up , because the css is no longer there.

Is there a way so that the defualt shows , if the one they had seleted is no longer avaliable.


Thanks for your help, this is one of my favorite mods
This mod should be made a sticky
Title: Re: [HACK] Many More colors with only ONE template
Post by: ch€ri{Bi}² on February 05, 2006, 02:52:32 PM
well,  2 things about it :

don't worry about it since you did not make the modification in header.html file (see STEP 2) in the new template. the script will use  the default value (style.css).

:? thank you to point this dysfunction...
There is something which misses in the original publication in connection with the checking of the presence (or not) of the css file chosen by the user (  :arrow: if the stylesheet is not found, it shows no style, just html text... dirty page  :evil:).

 :idea: here the code to repair this:

In STEP 1, replace this code :
Quote
$mycss = $design.'.css';
by this one :
Code: [Select]
$mycss = (in_array ($design, $list_css))? $design.'.css' : 'style.css'; //style.css is the default style in 4images : try to keep it unchanged in your tempalte directory

You should be sure that the style.css file is present in the directory  :wink:
Original code updated.
Title: Re: [HACK] Many More colors with only ONE template
Post by: impss on February 05, 2006, 10:37:38 PM
THanks cheribibi

That did it  8)
Title: Re: [HACK] Many More colors with only ONE template
Post by: rinaldos on February 24, 2007, 10:20:01 PM
Thanks for this nice colorfull MOD :-)

It works on my Website :-)

Greetings
Ingo
Title: Re: [HACK] Many More colors with only ONE template
Post by: m.a on February 27, 2008, 06:46:19 AM
Hi Acidgod,
Es gibt ein Problem, wenn auf der Seite verschiedene Sprache instaliert sein!
Nämlich:
Die Seite kehrt immer auf default-Sprache zurück, wenn man Farb-Änderung b.z.w Style.css wechselt.
Hast du auch das Problem?

Danke dir im Voraus
m.a




nicht in den access log schauen, du musst dann auch im error log schauen... (o:

Ist jetzt nur eine Vermutung...