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: I need to create 2 different templates for the same theme!  (Read 6985 times)

0 Members and 1 Guest are viewing this topic.

cream

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
I need to create 2 different templates for the same theme!
« on: June 18, 2006, 07:18:30 pm »

Hi

As I told you before, I want my home page to look different than the rest, and in order to do that, I was thinking about creating 2 different templates because I know html and no php.

In my home page I need part of the space to introduce my website to the user, an explanation of the web purposes, and links to sample galleries and registration. Also, I need to reserve part of the right side to google adsense, but I want this 2 things just in the index.php and I don't know how to redirect this page to a second template.

Here is the link to my website: http://www.comunidadf.com/

Regards,
cream
« Last Edit: July 04, 2006, 05:59:33 am by GauGau »
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: I need to create 2 different templates for the same theme!
« Reply #1 on: June 18, 2006, 09:22:47 pm »

you can simply create a home page with html as you like and then put the link of your gallery there and put a login form (here is an example) and also a link to registartion form and use cpmfetch mod to add some pic from your gallery.
Logged
‍I don't answer to PM with support question
Please post your issue to related board

cream

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: I need to create 2 different templates for the same theme!
« Reply #2 on: June 22, 2006, 02:26:30 pm »

That doesn´t solve what I need.

Is there any possibility that I can introduce 2 tables in index.php? or can I create 2 different templates, one for the index.php and another one for the rest of files?

pls, answer, this is my last step! ;D

Thanks for all,
cream
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: I need to create 2 different templates for the same theme!
« Reply #3 on: June 22, 2006, 02:43:27 pm »

Gallery set its default theme from DB (xxx_config table) , every page will check db for its template in this way you can't have 2 different themes for 1 gallery
Unless you modify all the links from index.php to other pages with add "?theme=2ndtheme" to them.
in this way you should set your default theme to "1sttheme" and when someone click on your link under index.php will see your other page with "2ndtheme"
Logged
‍I don't answer to PM with support question
Please post your issue to related board

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: I need to create 2 different templates for the same theme!
« Reply #4 on: June 22, 2006, 03:36:50 pm »

The only issue with what bmossavari said is that when you click back to index.php, it will show in the 2nd theme.  Coppermine stores the theme set in the URL with ?theme=2ndtheme in the user's cookie and uses that for pages that don't have the theme explicitly set, ignoring the original default of Coppermine. 

One way to unset the theme in the user's cookie is to send a bogus theme such as ?theme=defaulttheme - assuming "defaulttheme" doesn't exist as a theme.  ("defaulttheme" is prettier than "bogustheme".)

So you would need to set the "Home" link to something like "index.php?theme=defaulttheme".  I'm not sure if that will cover all the places that index.php is linked.  Report your results in case anyone else may be curious.
Logged

cream

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: I need to create 2 different templates for the same theme!
« Reply #5 on: June 22, 2006, 05:21:52 pm »

Ok, I have done the first step, I have created 2 different themes the way I wanted them, but when I go to index.php, I don´t know how to find all the links, as I told you, I don´t know php, and I just get syntasis errors went I try to change some of the "supossed links for me".

Can you write an example of a link redirected to the second them in index.php, PLS!!!

Regards,
cream

Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: I need to create 2 different templates for the same theme!
« Reply #6 on: June 22, 2006, 06:06:27 pm »

to change the links you should edit theme.php ,
- did you used a standard cpg theme for 1st and 2nd theme? (if yes tell us which)
- if you didn't use a standard theme then please attach it here
other member/dev/supporter may help you if they have time
Logged
‍I don't answer to PM with support question
Please post your issue to related board

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: I need to create 2 different templates for the same theme!
« Reply #7 on: June 22, 2006, 06:07:21 pm »

bmossavari submitted his reply while I was typing this one.  Take that into account when reading this post.

I didn't think about your first post carefully when I posted here; I was merely adding on to the last thing said.  Not a good idea, I know.

(1) Your site is running Coppermine 1.4.2.  There are some serious security issues that are fixed in the current version 1.4.8.  You are strongly recommended to upgrade - soon!  If you haven't modified core scripts, the upgrade is simple.  Themes have not changed since 1.4.2 so your custom themes will work just fine.

(2) Please post the names of your 2 themes.  I'm curious to see the differences.  If the colors & layout is the same, but the only difference is the content (with the added blocks you mentioned), I'm wondering if it would be much easier to just use one theme with logic in it to add those blocks only when main page is shown.  Using 2 themes would be overkill for such a task.

(3) To modify the links as mentioned, you'd have to use something like a plugin to modify those links automatically.  I don't think it would be that complicated, but I'm not sure if there are any issues that might come up.  I or someone else could write up the simple "search & replace" plugin for those links to see if it would work.

(4) One last thing I don't understand.  Do you only want the first page a user sees to have this added content?  If so, saying "index.php" is not correct, since it is used to display subcategories as well which are not on the first page a user sees.  For example: http://www.comunidadf.com/index.php?cat=1
Logged

cream

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: I need to create 2 different templates for the same theme!
« Reply #8 on: June 22, 2006, 06:42:50 pm »

Hello again! ;)

The colors & layout of my 2 themes are exactly the same (I´m using hardwire, but I have changed images and something else to make it look the way I want it). As you said before, the only one difference between the 2 themes are the 2 blocks I want to add. So, I agree with you that it would be much easier to add this blocks when the main page is shown. Yes, I just want the first page a user sees to have this added content. So, what do I have to do in this case? ???

Thank u for the reminder of upgrading my version to the new one, I´ll do it as soon as I'm done with this issue!

Regards,
cream

Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: I need to create 2 different templates for the same theme!
« Reply #9 on: June 22, 2006, 07:17:45 pm »

In that case, I recommend using the 'anycontent' block.  Put 'anycontent' in the config setting "the content of the main page", then put your 2 blocks into the file anycontent.php.  This block is only shown when the main gallery is shown (i.e. when the category display is '0').  It is not shown for any subcategories.

Even though anycontent.php is a PHP file, it's easy to add HTML to it.  Here's the default file (leaving out the comments at the beginning):
Code: [Select]
<?php
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
starttable("100%""Welcome");
?>

<tr><td class="tableb" >
This is for any content block - just a test - Edit the file "anycontent.php" to change what is shown here
</td></tr>
<?php
endtable
();
?>


As you can see the part in the middle, starting with <tr> and ending with </tr> is just straight HTML.  It occurs between the end PHP tag ?> and the starting PHP tag <?php which surrounds it.  Put whatever HTML you want there and you should be all set.  The PHP functions starttable and endtable create the <table> tags using your theme settings.  You just need to provide the cell content.  Of course you can change this however you like.
Logged

cream

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: I need to create 2 different templates for the same theme!
« Reply #10 on: June 22, 2006, 08:42:08 pm »

Hi Paver!
I´ve done exactly what you said.
 
I wrote anycontent.php in the config setting "the content of the main page".
I put 1 of the 2 blocks into the file anycontent.php. Here it is...
Code: [Select]
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

starttable("100%", "Welcome");

?>

<tr align="left">
    <td width="700"> <img src="themes/hardwired/images/texto.gif" width="700" height="150" alt="" /> </td>
</tr>


<?php
endtable
();

?>


But, it just doesn´t work! :'(

When I go to...  comunidadf.com/anycontent.php, I just get 'Not in Coppermine'.

Do you know what I´m doing wrong?

Pls, help!

Regards,
cream
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: I need to create 2 different templates for the same theme!
« Reply #11 on: June 22, 2006, 08:56:20 pm »

You cannot access the file directly - hence the "not in coppermine" message.  That is by design.

In the "content of the main page" setting, you need to put in "anycontent" - leave off the .php at the end.
Logged

cream

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: I need to create 2 different templates for the same theme!
« Reply #12 on: June 22, 2006, 09:10:13 pm »

Ok

I changed that, and I previously uploaded anycontent.php to the server, but when go to http://www.comunidadf.com/, nothing happens, and when I click on 'Home'. This is what I get:

"Not Found
The requested URL /anycontent was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.36 Server at www.comunidadf.com Port 80".  ???


Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: I need to create 2 different templates for the same theme!
« Reply #13 on: June 22, 2006, 09:27:32 pm »

You put 'anycontent' in the wrong spot.  The URL of the home page should be "index.php".  The "content of the main page" under "Album list view" should include "anycontent" as one of the blocks - put it in the order you like (with "breadcrumb" and "catlist" and so on).
Logged

cream

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: I need to create 2 different templates for the same theme!
« Reply #14 on: June 23, 2006, 03:39:13 pm »

Hi
I finally got it working, and I have the first block the way I wanted (well, I´m working on that, but I know I can do it), but I have one more question. I want the second block (where publicity goes) starting from categories until the end, on the right (a little table with a widht of 20% approximately). Here there is a link to the home page to show you how I want it (is the space with the google image, it is in theme.php just to show it to you, but you know that I have to take it out from there): http://www.comunidadf.com/index.php

How can I make it look like this? Because it seems that if I create a block, it has to be under categories, or under favorites, or under last images. But not accross them, on the right.

I hope u can help me one more time and if I can make this work out I promise I´ll leave u in peace.

Thanks again for your help!

Regards,
cream
Logged
Pages: [1]   Go Up
 

Page created in 0.064 seconds with 15 queries.