Poll

What do you think about this  hack ?

Great! i want the same at home.
I like the idea.
I like the idea but not the realization.
I do not like this idea.
It is very bad.

Author Topic: [HACK] Many More colors with only ONE template  (Read 60322 times)

0 Members and 1 Guest are viewing this topic.

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: [HACK] Many More colors with only ONE template
« Reply #15 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

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Re: [HACK] Many More colors with only ONE template
« Reply #16 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)
ch€ri{Bi}²


Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: [HACK] Many More colors with only ONE template
« Reply #17 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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [HACK] Many More colors with only ONE template
« Reply #18 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
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: [HACK] Many More colors with only ONE template
« Reply #19 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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [HACK] Many More colors with only ONE template
« Reply #20 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.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: [HACK] Many More colors with only ONE template
« Reply #21 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


Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Re: [HACK] Many More colors with only ONE template
« Reply #22 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)
ch€ri{Bi}²


Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: [HACK] Many More colors with only ONE template
« Reply #23 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

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Re: [HACK] Many More colors with only ONE template
« Reply #24 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();
ch€ri{Bi}²


Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: [HACK] Many More colors with only ONE template
« Reply #25 on: September 29, 2005, 06:19:29 PM »

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Re: [HACK] Many More colors with only ONE template
« Reply #26 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?
ch€ri{Bi}²


Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [HACK] Many More colors with only ONE template
« Reply #27 on: September 29, 2005, 09:19:33 PM »
IMO - in my opinion ...  :wink:
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline impss

  • Sr. Member
  • ****
  • Posts: 382
    • View Profile
    • Cusstom.net
Re: [HACK] Many More colors with only ONE template
« Reply #28 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.

Offline ch€ri{Bi}²

  • Sr. Member
  • ****
  • Posts: 315
  • A PRoBLeM wIthOUt SoLuTioN Is NoT rEAllY a PRoBLeM
    • View Profile
    • Pat's Gallery
Re: [HACK] Many More colors with only ONE template
« Reply #29 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.
ch€ri{Bi}²