insert a php script
capslock 0
From: -
From: -
Notice
This topic is archived. New comments cannot be posted and votes cannot be cast.Responses to this topic
1 Re: insert a php script
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
insert a php script
Please post your modified site_header template
Please post your modified site_header template
1 Re: insert a php script
capslock
OP
0
From: -
From: -
insert a php script
no, nothing shown
no, nothing shown
1 Re: insert a php script
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
insert a php script
Another idea. Open site_header and add after:
the entire modified crandom.php script incl. dbconnect();:
and in the HTML part:
Does this work?
Another idea. Open site_header and add after:
<?php
global $insert;
the entire modified crandom.php script incl. dbconnect();:
//***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="https://www.contentteller.com/' . $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="https://www.contentteller.com/' . $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:
$gallery
Does this work?
1 Re: insert a php script
capslock
OP
0
From: -
From: -
insert a php script
yes
yes
1 Re: insert a php script
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
insert a php script
In which directory did you copy the modified crandom.php script? In the Storyteller main directory?
In which directory did you copy the modified crandom.php script? In the Storyteller main directory?
1 Re: insert a php script
capslock
OP
0
From: -
From: -
insert a php script
yes, it works stand alone.
yes, it works stand alone.
1 Re: insert a php script
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
insert a php script
I guess it's time to debug.
Open the modified crandom script and add before:
the following:
Now try to run the script from your browser. Does it work?
I guess it's time to debug.
Open the modified crandom script and add before:
?>
the following:
echo $gallery;
Now try to run the script from your browser. Does it work?
1 Re: insert a php script
capslock
OP
0
From: -
From: -
insert a php script
yes i did, but nothink is shown
yes i did, but nothink is shown
1 Re: insert a php script
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
insert a php script
Did you add in the HTML part:
Did you add in the HTML part:
$gallery
1 Re: insert a php script
capslock
OP
0
From: -
From: -
insert a php script
sorry, doesn't work!
no error now, but nothing showed.
sorry, doesn't work!
no error now, but nothing showed.
1 Re: insert a php script
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
insert a php script
Add after:
the following line:
Add after:
include("crandom.php");
the following line:
dbconnect();
1 Re: insert a php script
capslock
OP
0
From: -
From: -
insert a php script
it gives me this error:
Error: 1146 Table 'gallery_moddingplanet_it.esselbach_st_online' doesn't exist
it gives me this error:
Error: 1146 Table 'gallery_moddingplanet_it.esselbach_st_online' doesn't exist
1 Re: insert a php script
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
insert a php script
Ok, here an updated script that should work with Storyteller:
To use this script, open site_header and add after:
the following:
Then add in the HTML part of this template $gallery where you like to show your images
Ok, here an updated script that should work with Storyteller:
<?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="https://www.contentteller.com/' . $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="https://www.contentteller.com/' . $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:
<?php
global $insert;
the following:
include("crandom.php");
Then add in the HTML part of this template $gallery where you like to show your images
1 Re: insert a php script
capslock
OP
0
From: -
From: -
insert a php script
<?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>');
echo('<a target = "_new" href="https://www.contentteller.com/' . $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//
echo('<IMG SRC="' . $copperminepath . '/albums/'); //append base dir structure
echo($MZrow['filepath'].thumb_.$MZrow['filename'] .
'" alt=' . $MZrow['filename'] . ' '. 'border=0 width=100 height=80>' . '</a> '); //outputs path from /userspics
echo('<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) ) {
echo('<FONT SIZE=1>');
echo('<P ALIGN=center>');
echo('<a href="https://www.contentteller.com/' . $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>' );
}
?>
1 Re: insert a php script
Philipp
From: Vienna, Austria
Administrator
1340From: Vienna, Austria
insert a php script
Can you post the source code of this script? It should be fairly easy to adapt this.
Can you post the source code of this script? It should be fairly easy to adapt this.
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