Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Poorly written Edit theme guide  (Read 12590 times)

0 Members and 1 Guest are viewing this topic.

-TRshady-

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
Poorly written Edit theme guide
« on: December 17, 2005, 01:21:43 am »

hope someone can help here.
I've updated coppermine but am now stuck with a poorly working template due to a poorly written edit theme.php guide to upgrade custom themes.
Following the page, we're told to start from scratch and follow steps ...

But you then go onto telling us to 'replace all instances' and so on where none exsists as we have not been told what more to copy over.

"If your theme modifies $template_display_picture replace it with $template_display_media"

This for example is confusing as we have not been told to copy over the display picture code, which only exsists in 'old.php'.
Anyone able to provide a better guide to help me get this working?

Thanks
Logged

artistsinhawaii

  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography
Re: Poorly written Edit theme guide
« Reply #1 on: December 17, 2005, 01:34:51 am »

TR shady,

Essentially, you simply copy the block of code you want to modify from the Sample theme's, theme.php file into your theme file.  Once it is in your theme, it overrides the same block in themes.inc.php. 

Dennis


 
Logged
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Poorly written Edit theme guide
« Reply #2 on: December 17, 2005, 01:37:36 am »

I wonder why you deal with such a poor script like coppermine, or look for support on a poor forum like this one. ::)
Logged

-TRshady-

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
Re: Poorly written Edit theme guide
« Reply #3 on: December 17, 2005, 01:44:50 am »

Please don't be so quick to resort to the 'don't like it, don't use it'. I'm being honest in saying this guide is hard to understand as I've dealt with upgrading and modding scripts for a long time now and I can imagine it being hard to understand for many. Coppermine is an excellent gallery, wouldn't use it if I didn't think so ( now quit fishing for compliments and try to help me  :P )

Thanks madeinhawaii, am still stuck though.
I've shown my theme.php below, the classic theme is very unlike mine so what parts would be copied over as it seems mine is different altogether.

Thanks for any help!  :)

( will post code in another post )
Logged

-TRshady-

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
Re: Poorly written Edit theme guide
« Reply #4 on: December 17, 2005, 01:48:36 am »

Can't post due to restrctions.
Code can be found here: http://shadygallery.com/themecode.txt
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Poorly written Edit theme guide
« Reply #5 on: December 17, 2005, 01:53:03 am »

Please don't be so quick to resort to the 'don't like it, don't use it'.
I prefer "don't like it, improve it". Where's your contribution?

now quit fishing for compliments and try to help me
I'm not fishing for compliments, yet I won't help you, as it's up to me if I do.

Can't post due to restrctions.
Where did you try to post, and what? You can't attach php files, so you'll have to rename them. In your case, you could have renamed theme.php to theme.php.txt and attached it to this posting.
Logged

-TRshady-

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
Re: Poorly written Edit theme guide
« Reply #6 on: December 17, 2005, 01:55:56 am »

Unless you are going to post anything of any use to anyone then please leave the server resources to those who will.
I'm past online altercations.
Logged

artistsinhawaii

  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography
Re: Poorly written Edit theme guide
« Reply #7 on: December 17, 2005, 02:08:12 am »

TRShady,

Backup your existing theme.php file.  Copy theme.php  from the Classic theme into your theme's folder.

Copy lines 57 -  182 from the sample theme into the newly ported theme.php file.  Paste it just above the " ?> ".

Edit the menu items to match what you had in your previous theme.php.  You'll have to play with this to see where each item goes as I have no visuals to work from.


Dennis
Logged
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

-TRshady-

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
Re: Poorly written Edit theme guide
« Reply #8 on: December 17, 2005, 02:18:22 am »

Thanks a lot Dennis, I'll give it a go.
( Just remembered I had a watermark mod which now needs re-installing .. this will be a long night  :'( )

Cheers

Edit:

This is the body of my template.html:

Code: [Select]
<div id="wrapper">
<img src="themes/shady/images/top.png" />

<div id="header">
<span class="main_name">{GAL_NAME}</span><br />
<span class="main_description">{GAL_DESCRIPTION}</span>
</div>

<div id="gallery">{GALLERY}</div>

<div id="sidebar">
<ul>
{SYS_MENU}
{SUB_MENU}
{ADMIN_MENU}
</ul>
</div>

<img style="vertical-align: bottom;" src="themes/shady/images/bottom.png" />
</div>

For some reason the last 3 {variables} are being ignored .. surely this isn't right?
Logged

artistsinhawaii

  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography
Re: Poorly written Edit theme guide
« Reply #9 on: December 17, 2005, 02:48:18 am »

Ah, you have discovered, that when you get into custom theming everything demands a very scientific trial-by-error, fly-by-the-seat-of-our-pants approach.  Especially when you are attempting the tableless format.


If memory serves me correctly, (and sometimes it does)  everything that comes below the {Gallery} falls into the "footer" section of the template.
If possible, try switching the placement between the three {variables} and {Gallery}

If that doesn't work and if you are using a custom footer, try disabling that in CONFIG till you get everything else up first.


Dennis
Logged
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

-TRshady-

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
Re: Poorly written Edit theme guide
« Reply #10 on: December 17, 2005, 02:58:34 am »

It seems Coppermine has just got even more complex with this release  :'(
I've made the change which worked ( thank you ) and am now with this:
http://www.shadygallery.com/

Will head off and return tomorrow, life has not treated me well today.  :P
But you have so thank you!
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Poorly written Edit theme guide
« Reply #11 on: December 17, 2005, 05:33:12 am »

A couple of things.

#1 I did a considerable amount of work re-working the theming system to make it faster and easier to upgrade themes by removing a LOT of redundant code.

#2 I wrote the majority of the current theme upgrade documentation, but I am not a documentation writer. I would very much like to know what areas weren't clear enough so that I could address them. Perhaps after gaining an understanding you could offer some suggestions which would put me on the right path.

#3 I looked at your posted http://shadygallery.com/themecode.txt and I immediately noticed that your using $template_main_menu1 and $template_main_menu2 which I KNOW the documentation covers the fact that those aren't used anymore.

#4 You said you had included "{SYS_MENU}{SUB_MENU}{ADMIN_MENU} " and Dennis already mentioned that they were AFTER {GALLERY} so they would be handled by pagefooter which is true. Thats not where 1.3 coppermine would look for replacing the menus either.  EVEN if you move those tokens above {GALLERY} your code will STILL have a problem because you included the old pageheader function in your theme.php which doesn't look to replace those tokens.

#5 I also noticed your insistence on moving over templates from the old theme, that don't need to be there. Most themes only edit MAYBE 5% of the themeable functions, which means you have to go upgrade a lot of the same code for absolutely no reason. If the look of your theme for that template or function doesn't do anything different than the classic theme then you can just omit it.  Thats why the theme upgrade process has you do several checks before you blindly go copying things from your old theme. Everything you move from your old theme has to be upgraded to be functional with 1.4.  The only way you know what needs to be upgraded is to compare your functions with the functions in sample's theme.php. It's a pain, and 95% of the time totally unnecessary.

For example:
Water-Drops theme.php from 1.3

See Attachment: There were too many lines of code to post in a single message.

here's water drop from 1.4
Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originaly written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.3
  $Source: /cvsroot/coppermine/stable/themes/water_drop/theme.php,v $
  $Revision: 1.14 $
  $Author: gaugau $
  $Date: 2005/11/28 07:43:00 $
**********************************************/

define('THEME_IS_XHTML10_TRANSITIONAL',1); // Remove this if you edit this template until
                                           // you have validated it. See docs/theme.htm.

// HTML template for template sys_menu spacer
$template_sys_menu_spacer ='<img src="themes/water_drop/images/orange_carret.gif" width="8" height="8" border="0" alt="" />';

?>


Would you prefer just to omit functions, or would you like to have to upgrade that entire 1.3 theme for XHTML compatability as well as all the changes for 1.4?

Which theme.php would you prefer to upgrade to 1.5?  

It really is particularly funny to me, that the reason I pushed to overhaul the themeing system is because I didn't want to write the theme upgrade documentation for identifying every bloody XHTML change that occured in the core code and separating that from real functional changes.  I upgraded several themes that way, and I can personally guarantee that the new method is better.  If you don't like the current theme documentation, you REALLY wouldn't have liked what the documentation would have looked like if we and done the same kind of docs that had been done for 1.2 -> 1.3 upgrades.
« Last Edit: December 17, 2005, 05:52:28 am by donnoman »
Logged

-TRshady-

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
Re: Poorly written Edit theme guide
« Reply #12 on: December 17, 2005, 10:26:29 am »

Thanks a lot for the wrong reply, I'm working on your advice.

I do have one question though, how come the 'classic' theme.php file is empty with only the intro code?

As the classic theme works fine but I can't make changes without knowing where to edit it ..
Would appreciate you telling me.

Cheers
Logged

-TRshady-

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 45
Re: Poorly written Edit theme guide
« Reply #13 on: December 17, 2005, 06:15:46 pm »

Finally managed it, though it's taken me over 12 hours, lol .. and I'm still not 100% yet ... got a few more changes to make here and there.
Thanks for the helpfull replies, managed to do it by studying other themes and then coding with those as a template.
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Poorly written Edit theme guide
« Reply #14 on: December 17, 2005, 07:45:06 pm »

In the themeing system there are 3 php files that are closely related in every install.

/include/themes.inc.php
/themes/classic/theme.php
/themes/sample/theme.php

the "classic" theme is the baseline theme for coppermine. It becomes the "fallback" for every other theme. Therefor what you used to know as the "guts" of the theme.php for classic was moved to /include/themes.inc.php then each template and function was "wrapped" with code to only execute if that specific function or template variable hadn't been defined.

That meant, including all the "guts" in the classic theme was redundant. It waste's cpu cycles to load a theme, that we know we are going to recheck, and not replace anything. (The lighter your theme is, the fewer cpu cycles have to be spent assembling the final templates and functions) So thats why the "classic" theme is empty, it actually doesn't need to override anything to look like itself.

Now, since we just removed all the guts out of the classic theme, and we wrapped all the function in themes.inc.php we didn't have a good reference theme to point theme developers to in order to see what CAN be themed.  Thats where the sample theme comes into play.

It's basically a copy of themes.inc.php with all of the wrapping code removed ready to be cut and pasted into a new theme. To encourage users to COPY to a new theme folder, the "sample" theme does not show up in the theme selection list.

And now I'll put the disclaimer I put every time I mention themes.inc.php.  This is NOT the place to make customizations unless you REALLY REALLY know what you are doing. Anything you do to themes.inc.php is a MOD and it will mean upgrade problems. It is the holy bible of what coppermine functions should be. Plugins are written expecting the items in theme.inc.php to be exactly what was delivered with the coppermine package, you may break plugins, and other users contributed themes if you begin modifying themes.inc.php.  If you are so inclined to modify themes.inc.php, its almost assured you should use a plugin instead.  Take a look at master_template over on cpg_contrib if you think you need to edit themes.inc.php. 

Logged

renatab

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 27
    • www.renatavonline.com
Re: Poorly written Edit theme guide
« Reply #15 on: December 19, 2005, 10:23:38 am »

well, i was trying to update some altered anime based theme, and it was hard. then i remembered that quite a while ago i learnt that nothing is as bad as  a site which shows no progress...
so i bit the bullet and redid from scratch on the basis of a so much improved 1.4.2..
does not mean i tell anyone that they need to reinvent their site... just a great opportunity here, isn't it?
fo one site that i haven't upgraded yet (reason:fear of messing up) i am thinking of just asking through the forum who woud do it for how much $$- then i can decide how much the old clutter is worth to me, huh?
as far as the theme guide goes it looks to me that one has to be able to totally understand the  different functions in the theme in order to know what to replace how... what a challenge... maybe those who updated a theme (like lovely anime) successfully could share their wisdom if they feel confident about the quality of what they did - i cannot see that there will be a guide written for each theme ( i bet donnoman can name us a price for doing that  ;) )
Logged
a shot says more than a thousand words...

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Poorly written Edit theme guide
« Reply #16 on: December 19, 2005, 10:33:34 am »

I recommend starting a separate thread on the paid help/freelancer board with your request for theming.
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Poorly written Edit theme guide
« Reply #17 on: December 20, 2005, 06:58:52 am »

I charge $100 / theme upgrade.

$200, if you've tried to do it first and failed.
$300, if you want me to write down HOW I did it.
$500, if you want to watch while I do it.

I hope y'all realize I'm joking...

I really charge $1000 / theme upgrade.

 :o
Logged
Pages: [1]   Go Up
 

Page created in 0.031 seconds with 19 queries.