How to use a different main page other than default How to use a different main page other than default
 

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]

Main Menu

How to use a different main page other than default

Started by jgsketch, October 01, 2005, 10:15:22 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

jgsketch

I would like to change the default index page to another page in coppermine, such as the register or login page. How can I change the default index page like this. My search only told me how to have a seperate index page outside of coppermine by having a subfolder on the server for coppermine. But what I'm trying to do is to still use a coppermine page with it's menus and theme. Thanks for the help.

artistsinhawaii

jg,

Nothing like the simple... right? ;)  Okay, the simplest method would be to see if your webhost has a redirect option, where anyone going to your domain would get redirected to another page.  And that redirected page would be : 

QuoteHttp://www.jgsketchsimplegallery.com/cpg/login.php

If you don't have that option, check with your webhost if you can use .htaccess files on your site.  If so, you simply need to create a new file with your notepad or text editor and enter  the following:

QuoteDirectoryIndex login.php index.php

Then save the file as .htaccess


Dennis
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.

Stramm

you'll have to edit index.php


find if (isset($HTTP_GET_VARS['cat'])) {
   $cat = (int)$HTTP_GET_VARS['cat'];

after it the } ... delete it

scroll down to the end and just before
?>
add
}else{ // no cat, we display the main
pageheader($BREADCRUMB_TEXT ? $BREADCRUMB_TEXT : $lang_index_php['welcome']);

<<<EOT


here you add your startpage content<br><br>
<p>htnl is of course allowed</p>


EOT;
   pagefooter();
   ob_end_flush();


}


Should work but I haven't tried. Necessary to open the standard startpage is to call it with index.php?cat=0
Album list in the menu is already doing this but not breadcrumb


to change this find in functions.inc.php  (2 occurances)
               $breadcrumb = '<a href="index.php">'.$lang_list_categories['home'].'</a>';
and replace with
               $breadcrumb = '<a href="index.php?cat=0">'.$lang_list_categories['home'].'</a>';

as said...  no guarantees and backup the files before you modify them

edit... to late and admitted, yours is easier ;) but I didn't want to throw that into the bin after all the typing

artistsinhawaii

Quoteedit... to late and admitted, yours is easier Wink but I didn't want to throw that into the bin after all the typing

Actually, if yours works that would be a nice first step in resolving my feature request.  :)
Now if you could just add the code to include it as an option in the admin menu...(kidding, well somewhat, okay maybe not).

Another message thread to add to my bookmarks, thanks Stramm.

Dennis

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.

jgsketch

Thanks for the help guys. I'll look into the code option, but like the simplicity of the redirect. Do you think that would have any adverse effects on SEO? I would assume not, I think the robots would follow the redirect like a user would. But I'm not sure.

Stramm

Quote from: madeinhawaii on October 01, 2005, 10:49:39 PM
Now if you could just add the code to include it as an option in the admin menu...

hahahaha... but that'll be the easy part  8)

artistsinhawaii

Quote from: jgsketch on October 01, 2005, 10:53:55 PM
Thanks for the help guys. I'll look into the code option, but like the simplicity of the redirect. Do you think that would have any adverse effects on SEO? I would assume not, I think the robots would follow the redirect like a user would. But I'm not sure.

It's just 34 characters in a text file, including spaces.  Try it, test it.  If it doesn't do the trick. Delete.  C'mon JG.. you can do it... ! JG! JG! JG!  ...   ;)

Sometimes, I think the best part about giving suggestions is that you can test things out without messing with your own setup.  ;)

Dennis
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

come on, that's bullsh** - who needs the login page as start page? Even logged in users will be directed to it. Just tweak you gallery a bit and send all unlogged users to your login page. Preferably, just apply this little hack: http://coppermine.sourceforge.net/faq.php#registeredUsersOnly

jgsketch

GauGau
I was just using those pages as an example...
Quote from: jgsketch on October 01, 2005, 10:15:22 PM
such as the register or login page.
Or any other page for that matter. I've decided to use the rateme page as my start page.

madeinhawaii
I'm going to try the code today. My site was down yesterday and this morning. I've decided to throw out the "simple". I have too much going on, on my site now.  :)

artistsinhawaii

QuoteI'm going to try the code today. My site was down yesterday and this morning. I've decided to throw out the "simple". I have too much going on, on my site now.   

I empathize with you.  With all the great features, mods, hacks, and add-ins, who can resist? Success with one mod, makes you take the next challenge.  When friends and family see what you are doing, you look like a genius.  It's just all too addictive. 

Dennis

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.

jgsketch

Ok, I got to try the code today. It worked to a certain extent. The code
}else{ // no cat, we display the main
pageheader($BREADCRUMB_TEXT ? $BREADCRUMB_TEXT : $lang_index_php['welcome']);

<<<EOT


here you add your startpage content<br><br>
<p>htnl is of course allowed</p>


EOT;
   pagefooter();
   ob_end_flush();


}

Did not show the content provide. I tried adding my own content and nothing showed up. Just my header footer and menues. I'm sorry, but I'm not that good with PHP yet, what is EOT?

I will try some more tinckering to see what I can do. Could I use an include to put the content of the page I want to show up? Most likely the Rateme.php file.

Stramm

uhps... should read



echo <<<EOT


the EOT isn't important... important is the <<<. It's called heredoc and after it usually is an identifier. You could replace EOT with YADDA if you want. Heredoc text behaves like a double quote text... just with no double quotes. So it's very comfortable to write html in here. Advantage is that variables get expanded.

Example:
<table align="center"><tr><td>>Your username:{USER_NAME}</td></tr></table>

So now you should know what to do


EOT;



jgsketch

Works great. And thanks for explaining the EOT, I see how that comes in handy. Thanks! ;D

Joachim Müller

Actually, it's not the letters "EOT" that do the magic, but the syntax relies on the use of the <<< chars. The letters EOT are just made up, but it has become best practise to use them - they're short for "end-of-transmission", an expression borrowed from telecomunications.
echo <<< FOOBAR
<p>Hello World</p>
FOOBAR;
would work just the same way. To find out details about this so-called "heredoc" syntax, go to http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

HTH

Joachim

jgsketch

I had a hard time making this work with 4.2. I kept getting unepected T errors. I ended up putting back the } after the if (isset($_GET['cat'])) {
        $cat = (int)$_GET['cat'];

I then got rid of the }else{ // no cat, we display the main
pageheader($BREADCRUMB_TEXT ? $BREADCRUMB_TEXT : $lang_index_php['welcome']);


That got rid of the unexpected T errors and the content showed up. However, I'm now stuck trying to get the content to show above the Album List. Actually, I would prefer to get rid of the album list off the main page but keep the "Last Updated" and "Top Rated" blocks. I think there are two ways to go about it, just not sure where in the code to place my code.

One: I think I could keep the pageheader($BREADCRUMB_TEXT ? $BREADCRUMB_TEXT : $lang_index_php['welcome']); code out leaving me with just the content I want to insert, then I would have to figure out where to place the rest of the code so that it shows up above the rest of the blocks in the index.php.

Two: I think I could reinsert the pageheader($BREADCRUMB_TEXT ? $BREADCRUMB_TEXT : $lang_index_php['welcome']); code and then I would just have the content show up and no other items. I could then add the other blocks such as "Last updated" and "Top Rated" blocks and keeping the album list off the index.php.

I've gone as far as I could on my own, even trying different code placements to get it right. I need a little direction on this one. Thank you.

Not sure if this should have been moved to the 4.2 forum or left intact.

Joachim Müller

shouldn't have gone into a cpg1.3.x thread that is marked as solved  ::)

jgsketch

Sigh... Sorry, trying not to open two threads on the same topic even though the new question involves 4.2. I'll post in 4.2 thread?