forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: sharky on October 28, 2007, 04:08:35 pm

Title: additional info page
Post by: sharky on October 28, 2007, 04:08:35 pm
hi all

is it possible / difficult to make a page called "infos.php" wich has following properties?

-background of the actual theme
-the text: "There are X new pics since your last login" (must work with bridged gallery too)
-the gallery infos "1 files in 15 albums and 5 categories with 0 comments viewed 2 times"


i would need a page like this in order to implement it on another page with an iframe. is tehre somebody who gently could make this? (ONLY if it is not too much work!)

thank you

igor
Title: Re: additional info page
Post by: sharky on October 28, 2007, 05:50:44 pm
i already solved part 1 and 3. the part with the new pics is still missing. i have an idea on how to solve it, but dont know if it is possible and how to program it. my idea is this: (maybe somebody can do it)

add 2 tables to the users called "oldnumber" and "displaynumber"
on login make this:

displaynumber = numberofpics - oldnumber
oldnumber = numberofpics

echo: there are displaynumber new pics.

just as idea.. i dont know if this is possible. and i dont know if it works with bridged boards.

bye

igor
Title: Re: additional info page
Post by: just_some_guy on October 28, 2007, 06:00:15 pm
Code: [Select]
<?php
$sql 
mysql_query("SELECT user_lastvisit FROM {$CONFIG['TABLE_USERS']} WHERE user_id = $uid");
$last_pics $sql;
$time now() - $last_pics;
$result mysql_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} WHERE mtime = $time");
$since_last =mysql_num_rows($result);

echo 
'There are '$since_last' new pics since your last login';

?>


Try this for the number of pictures since last visit. I may be wrong around the now() part. It quite easy to do, i used code from this (http://uk2.php.net/mysql-num-rows) part of the manual to get the number of pictures and I worked out the time diffrence and retriving the results.

Good Luck!

just_some_guy

Title: Re: additional info page
Post by: sharky on October 28, 2007, 10:37:40 pm
hi! thank you for your help! unfortunately the code hangs somewhere.

if i have:

somecode
echo A

the result is "A" written in the page.

if i have:

somecode
yourcode
echo A

the page is empty.

i dont knwo anything of php.. so i hope somebody can help me out. ill post then the whole finished code. maybe somebody else needs it.

thank you again
Title: Re: additional info page
Post by: sharky on October 28, 2007, 11:03:53 pm
i googled a bit and discovered that the now() function is a sql function and not a php function. this means that i need to make a query to the database and assign the now() function result to a php variable.. but HOW? :D

bye

thanks

igor
Title: Re: additional info page
Post by: Nibbler on October 28, 2007, 11:08:03 pm
The php equivalent is time(), however the code posted above is hopelessly wrong so don't waste much time on it.
Title: Re: additional info page
Post by: sharky on October 28, 2007, 11:18:15 pm
thank you nibler!

yeah something is wrong.. it gives allways "0" as value.

nibler do you know a solution to this problem?

thanks

igor
Title: Re: additional info page
Post by: Joachim Müller on October 29, 2007, 07:52:26 am
Running "regular" mysql queries is not recommended anyway, you better use the equivalent functions used by Coppermine. What you're up to is called "content syndication", i.e. displaying content taken from coppermine on another page. There's a whole sub-board dedicated to this that contains mods that do what you're up to.
Title: Re: additional info page
Post by: sharky on October 29, 2007, 11:22:04 am
hi gaugau!

thank you for pointing me in the correct direction!

i checked the section but was not able to find anything similar to this.

ty

igor