insert a php script I need to insert the latest pics from my gallery in right col of ST. Just like this: http://gallery.moddingplanet.it/crandom.php Is there a way to do this? Thanks a lot
insert a php script Can you post the source code of this script? It should be fairly easy to adapt this.
insert a php script Ok, here an updated script that should work with Storyteller: Code: <?php //***Enter Path information here*** //***absolute path to main coppermine directory*** $copperminepath = 'http://gallery.moddingplanet.it'; //***YOU MUST CHANGE THIS*** //This connects to the mysql DB //***change username and password below*** $MZrandompic = @mysql_connect('localhost', 'uname', 'password'); //***YOU MUST CHANGE THIS*** if (!$MZrandompic) { echo( '<p>Unable to connect to the ' . 'database server at this time.</p>' ); exit(); } //select photo DB //***You must change this to match your coppermine database name //@mysql_select_db('forum')// if (! @mysql_select_db('dbname') ) { die( '<p>Unable to locate the picture ' . 'database at this time.</p>' ); } //This gets a random picture record from the database and //the picture's location and displays it //change this to match your coppermine table prefix //change the limit 0,5 is good for the center block and default thumbnail size// $MZresult = @mysql_query("SELECT * FROM cpg11d_pictures ORDER BY RAND() LIMIT 0,6"); //$MZresult = @mysql_query("SELECT * FROM cpg11d_pictures ORDER BY ctime DESC LIMIT 0,6"); if (!$MZresult) { die('<p>Error performing query: ' . mysql_error() . '</p>'); } while ( $MZrow = mysql_fetch_array($MZresult) ) { // $albumid = $MZrow['aid']; //This gets the picture's associated album name $pos = $MZrow['pid']; //This finds the picture's coppermine location // echo('<P ALIGN=center>'); $gallery .= '<a target = "_new" href="' . $copperminepath . '/displayimage.php?album=' . $albumid . '&pos=-' . $pos . '">'; //make thumbnail clickable // you cna adjust the thumbnail sizes by changing the with and height// //the default is set to border=0 width=60 height=50 // //based on the center block size// $gallery .= '<IMG SRC="' . $copperminepath . '/albums/'; //append base dir structure $gallery .= $MZrow['filepath'].thumb_.$MZrow['filename'] . '" alt=' . $MZrow['filename'] . ' '. 'border=0 width=100 height=80>' . '</a> '; //outputs path from /userspics $gallery .= '<br/>'; //append base dir structure } //This displays the picture's album name and //links it to the coppermine album //change this to match your coppermine table prefix $MZalbumresult = @mysql_query("SELECT * FROM cpg11d_albums WHERE aid = '$albumid'"); if (!$MZalbumresult) { die('<p>Error performing query: ' . mysql_error() . '</p>'); } while ( $MZalbumname = mysql_fetch_array($MZalbumresult) ) { $gallery .= '<FONT SIZE=1>'; $gallery .= '<P ALIGN=center>'; $gallery .= '<a href="' . $copperminepath . '/thumbnails.php?album=' . $albumid . '">' . $MZalbumname['title'] . '</a>' . '</p>'; } // change line below to match your galley database name// if (! @mysql_select_db('gallery_moddingplanet_it') ) { die( '<p>Unable to reload the main website ' . 'database at this time.</p>' ); } ?> To use this script, open site_header and add after: Code: <?php global $insert; the following: Code: include("crandom.php"); Then add in the HTML part of this template $gallery where you like to show your images
insert a php script it gives me this error: Error: 1146 Table 'gallery_moddingplanet_it.esselbach_st_online' doesn't exist
insert a php script I guess it's time to debug. Open the modified crandom script and add before: Code: ?> the following: Code: echo $gallery; Now try to run the script from your browser. Does it work?
insert a php script In which directory did you copy the modified crandom.php script? In the Storyteller main directory?
insert a php script Another idea. Open site_header and add after: Code: <?php global $insert; the entire modified crandom.php script incl. dbconnect();: Code: //***Enter Path information here*** //***absolute path to main coppermine directory*** $copperminepath = 'http://gallery.moddingplanet.it'; //***YOU MUST CHANGE THIS*** //This connects to the mysql DB //***change username and password below*** $MZrandompic = @mysql_connect('localhost', 'uname', 'password'); //***YOU MUST CHANGE THIS*** if (!$MZrandompic) { echo( '<p>Unable to connect to the ' . 'database server at this time.</p>' ); exit(); } //select photo DB //***You must change this to match your coppermine database name //@mysql_select_db('forum')// if (! @mysql_select_db('dbname') ) { die( '<p>Unable to locate the picture ' . 'database at this time.</p>' ); } //This gets a random picture record from the database and //the picture's location and displays it //change this to match your coppermine table prefix //change the limit 0,5 is good for the center block and default thumbnail size// $MZresult = @mysql_query("SELECT * FROM cpg11d_pictures ORDER BY RAND() LIMIT 0,6"); //$MZresult = @mysql_query("SELECT * FROM cpg11d_pictures ORDER BY ctime DESC LIMIT 0,6"); if (!$MZresult) { die('<p>Error performing query: ' . mysql_error() . '</p>'); } while ( $MZrow = mysql_fetch_array($MZresult) ) { // $albumid = $MZrow['aid']; //This gets the picture's associated album name $pos = $MZrow['pid']; //This finds the picture's coppermine location // echo('<P ALIGN=center>'); $gallery .= '<a target = "_new" href="' . $copperminepath . '/displayimage.php?album=' . $albumid . '&pos=-' . $pos . '">'; //make thumbnail clickable // you cna adjust the thumbnail sizes by changing the with and height// //the default is set to border=0 width=60 height=50 // //based on the center block size// $gallery .= '<IMG SRC="' . $copperminepath . '/albums/'; //append base dir structure $gallery .= $MZrow['filepath'].thumb_.$MZrow['filename'] . '" alt=' . $MZrow['filename'] . ' '. 'border=0 width=100 height=80>' . '</a> '; //outputs path from /userspics $gallery .= '<br />'; //append base dir structure } //This displays the picture's album name and //links it to the coppermine album //change this to match your coppermine table prefix $MZalbumresult = @mysql_query("SELECT * FROM cpg11d_albums WHERE aid = '$albumid'"); if (!$MZalbumresult) { die('<p>Error performing query: ' . mysql_error() . '</p>'); } while ( $MZalbumname = mysql_fetch_array($MZalbumresult) ) { $gallery .= '<FONT SIZE=1>'; $gallery .= '<P ALIGN=center>'; $gallery .= '<a href="' . $copperminepath . '/thumbnails.php?album=' . $albumid . '">' . $MZalbumname['title'] . '</a>' . '</p>'; } // change line below to match your galley database name// if (! @mysql_select_db('gallery_moddingplanet_it') ) { die( '<p>Unable to reload the main website ' . 'database at this time.</p>' ); } dbconnect(); and in the HTML part: Code: $gallery Does this work?