Hi. I have one ask. It is possible to have pictures from the page "Recent pictures" on another page?
I wish to have newest photos from gallery on the main page.
Thanks a lot.
Hi Lum,
install the plugin "localfiles editor"
with localfiles editor select tabstrip "personal plugin"
insert
<?php /* Plugin Name: Personnel Plugin Version: 1.0 Description: Personnel Plugin Plugin URI: http://www.phpwebgallery.net Author: P@t Author URI: */ add_event_handler('loc_begin_index', 'personal_get_random_image'); function personal_get_random_image() { global $page, $template; if (isset($page['section']) and $page['section'] == 'categories' and !isset($page['category'])) { $query = 'SELECT img.path AS path, img.file AS file FROM ' . IMAGE_CATEGORY_TABLE . ' AS ic INNER JOIN ' . IMAGES_TABLE . ' AS img ON ic.image_id = img.id WHERE ' . get_sql_condition_FandF(array ('forbidden_categories' => 'ic.category_id'), '', true) . ' ORDER BY RAND() LIMIT 1;'; $img = mysql_fetch_array(pwg_query($query)); $template->assign_vars(array( 'PERSONAL_RANDOM_IMAGE' => '<img src="' . $img['path'] . '" alt="' . $img['file'] . '">')); } } ?>
at last, don't forget to activate your personal plugin.
Thx to P@t for this solution.
:-))
Offline
Thanks for your (very quick) help. :-)
I have additionaly one problem. When I open the file "(...)/plugins/PersonalPlugin/main.inc.php", there's a message- Fatal error: Call to undefined function add_event_handler() in (...)plugins/PersonalPlugin/main.inc.php on line 11 .
What's wrong?
You don't need to open this file!
Install and active LocalFiles Editor.
Copy and past the code into the 5th tab (Personal Plugin)
Then, install and activate the personal plugin in the plugin administration panel.
You also need to install and activate PWG Stuffs
Then, in PWG Stuffs, create a personal block (you can call it "Recent picture" for example)
In this block, you will enter this code to add a random picture:
{PERSONAL_RANDOM_IMAGE}
Offline
Sorry Lum,
I realize that my answer not respond to your question.
In fact, you can simply redirect the first screen to the recent picture page.
with localfiles editor select first tabstrip.
insert
$conf['random_index_redirect'] = array( PHPWG_ROOT_PATH.'index.php?/recent_pics' => 'return $user;' );
You can specify 'return $user[\'is_the_guest\'];' if you want that happen only for guest user.
apologize :-/
:-))
Offline
This was so easy to set up, but I have a problem.
When I use the secureimages plugin there is no image displayed, I just get the red x with the alt description.
Is there anyway that this could be made compatible? and able to display more than one random image too?
I would even be interested in knowing how to make the php code above display 5 different random images, if possible.
Last edited by Jive Bunny (2008-09-13 17:53:39)
Offline