Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Removing content with Themes?  (Read 6121 times)

0 Members and 1 Guest are viewing this topic.

zharling

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Removing content with Themes?
« on: February 01, 2005, 03:16:25 am »

I have a site for my kid that uses iframes and I wanted to link in coppermine, problem is I need to slim it way down.  I can remove the head stuff with themes but can not seam to remove the content (ie random images and newly added images)  I know I can do this via config but the goal was to have one theme for my kids site then another for the rest of the pictures I wanted to put into coppermine and use a theme that is not 'slimmed down'.

The only way I could think of doing it was to have two installes and two db's, I'd rather not do that if I don't have to.

Anyone have any suggestions?
« Last Edit: February 11, 2005, 01:43:48 pm by GauGau »
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Removing content with Themes?
« Reply #1 on: February 01, 2005, 04:27:45 am »

in your include/init.inc.php right BEFORE the final "?>" thats at the end of the page; insert this:
Code: [Select]
// override main_page_layout for a specific theme
$CONFIG['main_page_layout'] = ($CONFIG['theme'] == 'water_drop') ? 'breadcrumb/alblist/catlist' : $CONFIG['main_page_layout'];
// override main_page_layout for a specific theme

This does it for the theme "water_drop"; of course you would substitute your own theme for that parameter.

Good luck.
Logged

zharling

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Removing content with Themes?
« Reply #2 on: February 01, 2005, 06:07:55 pm »

Damm... That is perfect!!! Thanks!!


Ok heres another one, hopefully its just as easy for you.

My kids site would iframe to .../index.php?theme=theme

But most ppl would just go to ../index.php and use whatever the default theme is, which WILL be diffrent that my kids site.

The problem is if I access my kids site using his theme then go back to my main album its using his theme, and visa verca.

Hopefully this makes sense and you have another good idea.

Thanks,
Logged

zharling

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Removing content with Themes?
« Reply #3 on: February 01, 2005, 06:13:28 pm »

Also forgot to ask above, is it documented anywhere what each config var is?

Like you said $CONFIG['main_page_layout'] was for "The content of the main page" 

I assume them to all have var names are they listed out anyplace?
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Removing content with Themes?
« Reply #4 on: February 02, 2005, 07:14:12 am »

Easy question first: How to find what config variables there are:

lang/english.php; find:
Code: [Select]
if (defined('CONFIG_PHP')) $lang_config_data = array(

Look at the items in the array: The first field is what it's used for; the second is what the index is for that variable.

Now for tricking coppermine to hand out a different cookie name for a specific theme:
(FYI, this is probably not a wise thing to do if you use Coppermine bridged to anything)

include/init.inc.php; find:
Code: [Select]
// Process theme selection if present in URI or in user profile
if (!empty($HTTP_GET_VARS['theme'])) {
    $USER['theme'] = $HTTP_GET_VARS['theme'];
}
// Load theme file
if (isset($USER['theme']) && !strstr($USER['theme'], '/') && is_dir('themes/' . $USER['theme'])) {
    $CONFIG['theme'] = strtr($USER['theme'], '$/\\:*?"\'<>|`', '____________');
} else {
    unset($USER['theme']);
}
if (!file_exists("themes/{$CONFIG['theme']}/theme.php")) $CONFIG['theme'] = 'classic';
require "themes/{$CONFIG['theme']}/theme.php";
$THEME_DIR = "themes/{$CONFIG['theme']}/";

change to:
Code: [Select]
// moved theme block to just under the include of media.functions.inc.php for cookie_name mod


include/init.inc.php; find:  
Code: [Select]
require 'include/media.functions.inc.php';

add after it:
Code: [Select]
// moved block so that the theme would be set prior to substituting the cookie_name
// Process theme selection if present in URI or in user profile
if (!empty($HTTP_GET_VARS['theme'])) {
    $USER['theme'] = $HTTP_GET_VARS['theme'];
}

// check referrer for our target theme; needed if a cookie has not been saved yet
// otherwise you will get the login screen from the theme from the regular cookie
// and it will not let you log on.
$USER['theme'] = (strpos($REFERER,'water_drop')) ? 'water_drop' : $USER['theme'];

// Load theme file
if (isset($USER['theme']) && !strstr($USER['theme'], '/') && is_dir('themes/' . $USER['theme'])) {
    $CONFIG['theme'] = strtr($USER['theme'], '$/\\:*?"\'<>|`', '____________');
} else {
    unset($USER['theme']);
}
if (!file_exists("themes/{$CONFIG['theme']}/theme.php")) $CONFIG['theme'] = 'classic';
require "themes/{$CONFIG['theme']}/theme.php";
$THEME_DIR = "themes/{$CONFIG['theme']}/";
// moved block so that the theme would be set prior to substituting the cookie_name

// override cookie_name for a specific theme
$CONFIG['cookie_name'] = ($CONFIG['theme'] == 'water_drop') ? 'cpg_water_drop' : $CONFIG['cookie_name'];
// override cookie_name for a specific theme

Hope that helps;

FYI, the two mod questions were pretty well related, so they were good to have in the same thread. In the future if you have a slightly off topic question it's better to create a new thread, that way its easier for others to search and find relevant answers based on the TITLE of the thread, rather than having to open and search each one.
Logged

zharling

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Removing content with Themes?
« Reply #5 on: February 02, 2005, 07:11:41 pm »

thanks for the response.  When I move that code and add that bit I get

Undefined variable: USER

do I need to Dim that var or something?


This is the line that is erroring out on
$USER['theme'] = (strpos($REFERER,'water_drop')) ? 'water_drop' : $USER['theme'];
« Last Edit: February 02, 2005, 07:27:49 pm by zharling »
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Removing content with Themes?
« Reply #6 on: February 03, 2005, 03:12:03 am »

that block should really come after the call to user_get_profile; but since we need to change the cookie before we get to that function; we have to mess with things a little bit.

find:
Code: [Select]
require 'include/media.functions.inc.php';

add after it:
Code: [Select]
$USER=array();

and the warning coming up in notices should go away.
Logged

zharling

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Removing content with Themes?
« Reply #7 on: February 03, 2005, 06:38:23 pm »

I added the code and its continues to come up, didn't seam to change anything/

if it helps here is the my URL

www.zdsys.com/album       <-- This is my main pic site
www.zdsys.com/jacob1/pics_new.html   <-- this is too my kids site that iframs into http://www.zdsys.com/album/index.php?theme=ZDSYS
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Removing content with Themes?
« Reply #8 on: February 04, 2005, 04:04:08 am »

move this block:
Code: [Select]
// check referrer for our target theme; needed if a cookie has not been saved yet
// otherwise you will get the login screen from the theme from the regular cookie
// and it will not let you log on.
$USER['theme'] = (strpos($REFERER,'water_drop')) ? 'water_drop' : $USER['theme'];

to just above this block:
Code: [Select]
// override cookie_name for a specific theme
$CONFIG['cookie_name'] = ($CONFIG['theme'] == 'water_drop') ? 'cpg_water_drop' : $CONFIG['cookie_name'];
// override cookie_name for a specific theme

The other thing to keep in mind is it's fine to have debug mode on when your working on mods like this,
but you should disable notices in debug, or at least restrict them to the admin when you go production.

My install isn't getting those errors even without moving the above block. I would review the changes you've made,
if you still can't nail it down, zip up your file and attach it to your post, and I'll take a look at it.

Also note that WATER_DROP != water_drop != Water_Drop

I didn't take any care to write the code to be tolerant of CASE. It simply looks
for string equivalence, if you have one character off, it's not going to work right.

ie: don't pass "theme=Water_Drop" if you modded it as "water_drop".
Logged

zharling

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Removing content with Themes?
« Reply #9 on: February 05, 2005, 02:10:29 am »

Still getting the same message.

I have tried to upload the content but for some reason its not working so I put it out on the web server you can download the zip from this url

[edit]link to file removed[/edit]
Again thanks for all of your help on this.
« Last Edit: February 05, 2005, 06:00:30 am by donnoman »
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Removing content with Themes?
« Reply #10 on: February 05, 2005, 07:33:40 pm »

The more I dig into this the more I come back with this is a no-can-do item.

You can override the cookie name when the page is passed with theme=ZDSYS, and even check the referrer links.

But many pages, like the alb catlist and thumbnails don't pass this information, so we've got no clues that we should change the cookie name. so the system reads the deafult cookie and switches the theme to whatever is in the default cookie name.

you can clean up your overrides for the ZDSYS theme as follows:
at the bottom of init.inc.php
Code: [Select]
// override settings for a specific theme
if (stristr($CONFIG['theme'],'ZDSYS')) {
    $CONFIG['main_page_layout'] = 'breadcrumb/alblist/catlist';
    $CONFIG['picture_width'] = '400';
}

I'm not finding an easy way to redirect the theme when you visit the site later without the iframe.

I would suggest a few possible routes to try and get what you want.

1) Just code a theme that matches Jacob's site and get rid of the iframe. At least you would be able to switch themes at that point.

2) Look at the mod coppermine fetch in the forums, perhaps if you use that and just pull the Jacob images out you might get something that will satisfy your needs.

3) If you want to try to bark up the change the cookie method, the only way I figure you would be able to get it to work is going through A LOT of coppermine code putting conditionals in such that if theme=zdsys then tack on &theme=zdsys to the href.  There's a lot of code that would need to be gone through to make it work. (That's why I suggest abandoning the idea of messing with the cookie name)

4) Make two galleries with different cookie_names.
Logged

zharling

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Removing content with Themes?
« Reply #11 on: February 05, 2005, 08:30:38 pm »

I can not thank you enough for the time you have spent investigating my request.

I think what I decided to do is to do a second install (two galleries) and write a script to go through and basically select out all new images out of the tbl in Jacob's and insert them into the main album. Then just keep two copies of the picutres on the server.


Should work.

Again thanks alot for all of your help.
Logged
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 19 queries.