forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: stock on August 20, 2005, 08:59:13 pm

Title: integrating code for home page
Post by: stock on August 20, 2005, 08:59:13 pm
Hello, I hope someone can help.

I'm trying to have a welcome come up on my home page, with different text once you have logged in, all with a table. I can do this without a table okay but when I try and incorporate the table code in, it all shows regardless of logged in or not.

I'd be very grateful if someone could tell me what is wrong here (this is on http://www.stockshoots.co.uk but this may be offline when this is read:

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

?>
<tr><td class="tableb">
if (USER_ID) {print 'Click on a lorum ipsum below.<br />
    Lorum ipsum lorum ipsum lorum ipsum here.<br /><br /><br />'
    } else {
    print 'Welcome to Stockshoots image library<br />
    A new source of original film and digital right-managed imagery.<br 1/>
    Click on the subject roundups below or use the seach tool on the right.<br />
You may need to login or register to see the images.<br /><br /><br />';
}
</td></tr>
<?php
endtable();

?>
Title: Re: integrating code for home page
Post by: stock on August 20, 2005, 09:00:54 pm
just to clarify my last post, the page starts with <?php and the commented out Coppermine gallery bit.

thanks

Stock
Title: Re: integrating code for home page
Post by: kegobeer on August 20, 2005, 09:28:07 pm
Code: [Select]
starttable("100%", "Welcome");

echo '<tr><td class="tableb">';
if (USER_ID) {print 'Click on a lorum ipsum below.<br />
 Lorum ipsum lorum ipsum lorum ipsum here.<br /><br /><br />';
 } else {
 print 'Welcome to Stockshoots image library<br />
 A new source of original film and digital right-managed imagery.<br 1/>
 Click on the subject roundups below or use the seach tool on the right.<br />
You may need to login or register to see the images.<br /><br /><br />';
}
echo '</td></tr>';

endtable();

?>
Title: Re: integrating code for home page
Post by: stock on August 20, 2005, 09:38:02 pm
Kegobeer,

many thanks for the help and speedy, but that code shows a parse error - it quotes the line that contains
} else {

is there something I have missed?

Thanks very much

Stock
Title: Re: integrating code for home page
Post by: Nibbler on August 20, 2005, 09:49:24 pm
You are missing a semicolon at the end of the line before that.
Title: Re: integrating code for home page
Post by: stock on August 20, 2005, 09:53:59 pm
Many many thanks Nibbler.  I should have spotted that!
Regards

Stock
Title: Re: integrating code for home page
Post by: kegobeer on August 20, 2005, 11:04:09 pm
That's what I get when I copy and paste too quickly!   ;D
Title: Re: integrating code for home page
Post by: stock on August 21, 2005, 12:33:49 am
I hate to be cheeky regarding this, but is it possible to tell me to add a line that opens up the table again the second time so you can have different bar wording when you go back to the home page as a logged in user. I know this is a coding query re changing the theme and hope you don't mind. I have tried and am learning php but I'm not there yet!

thanks, Stock


Existing code:

starttable("100%", "A new source of rights-managed images");

echo '<tr><td class="tablehome">';
if (USER_ID) {
print 'Click on a lorum ipsum below.<br />
Lorum ipsum lorum ipsum lorum ipsum here.<br /><br /><br />';
} else {
print '<STRONG><FONT SIZE=+2>Welcome to Stockshoots lorum impus</STRONG></FONT><br />
A new lorum ipsum etc of original film and digital right-managed imagery.<br 1/>
Click on the subject roundups below or use the seach tool on the right.<br />
You may need to login or register to see the images.<br /><br /><br />';
}
echo '</td></tr>';

endtable();
?>
Title: Re: integrating code for home page
Post by: kegobeer on August 21, 2005, 12:36:50 am
If you mean you want a different table header for logged in/not logged in...

Code: [Select]
if (USER_ID) {
starttable("100%", "A new source of rights-managed images");

echo '<tr><td class="tablehome">';
print 'Click on a lorum ipsum below.<br />
Lorum ipsum lorum ipsum lorum ipsum here.<br /><br /><br />';
} else {
starttable("100%", "You are not logged in");

echo '<tr><td class="tablehome">';
print '<STRONG><FONT SIZE=+2>Welcome to Stockshoots lorum impus</STRONG></FONT><br />
A new lorum ipsum etc of original film and digital right-managed imagery.<br 1/>
Click on the subject roundups below or use the seach tool on the right.<br />
You may need to login or register to see the images.<br /><br /><br />';
}
echo '</td></tr>';

endtable();
?>
Title: Re: integrating code for home page
Post by: stock on August 21, 2005, 12:44:55 am
kegobeer

that is exactly it. thanks very very very much. I did try something like that but got all tongue tied.

Stock

if you want you can close this now. cheers again.