Hi,
Link to my site: http://www.fotogenico.net/site
SMF version: SMF ver. 1.1.7
TP version: TP ver. 1.0.5 beta
DzinerStudio : Mystic Jade
Mods installed: Advshoutbox
It's possible put a include php file or smae php code in one block in the front page?
I want to show featured photos from my gallery in the front page of the forum.Like in this site www.enfoca2.com
(http://www.enfoca2.com)
Thanks for your help and sorry my poor english.
Fernando
What gallery do you use ?
If you have coppermine then the answer is yes, but you need to have cpmfetch from commermine to get it to work.
If you have SMF gallery, jut use Thurnoks code from the block code and snippets board, it holds a lot of good features.
www.familjegodis.se uses thurnoks code on the frontpage php top block.
Hi,
I use the Photopost gallery.
Thanks,
Yes, you can create a php block to go wherever you want it to be and, in that block, you can include another php file.
Thnaks,
For example, if I paste this code in one php block.Works?
<?php
$host = 'localhost';
$dbUser = '*****';
$dbPass = '*****';
$db = '.......';
mysql_connect("$host", "$dbUser", "$dbPass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());
$result = mysql_query("SELECT id,cat,bigimage FROM pp_photos order by rand() LIMIT 1" ) or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
print "<a href=\"/photos/showphoto.php/photo/" . $row['id'] . "\"><img src=\"/testegaleria/data/" . $row['cat'] . "/thumbs/" . $row['bigimage'] . "\"></a>";
}
?>
Thanks,
Did you try it?
Hi,
Yes, but get this error
Parse error: syntax error, unexpected '<' in /home/fotogeni/public_html/testeforum/Sources/Load.php(1735) : eval()'d code(52) : eval()'d code on line 1
Actually, no, that won't work. You can only have one database open at a time. If you open another database, you'll close the SMF database and nothing after that block that relies on the db will work.
You would do better to put your tables into the SMF database and then use the built-in structure for accessing the database. Once you move your tables, this would be the whole code that you would need to go into a block.
$result = db_query("SELECT id,cat,bigimage
FROM pp_photos
ORDER BY RAND()
LIMIT 1", __FILE__, __LINE__);
$row = mysql_fetch_array($result);
print "<a href=\"/photos/showphoto.php/photo/" . $row['id'] . "\"><img src=\"/testegaleria/data/" . $row['cat'] . "/thumbs/" . $row['bigimage'] . "\"></a>";
The reason you got the error you did is that you don't use the
<?php
at the beginning or
?>
at the end of php code in the blocks.
Thaks,
SMF and Photopost share the same database.
Ah. Well, then that solves the problem! Cool. 8)
You're welcome.
Hi,
Thanks,
Don't work !
I tried now put only this code
<?php
include('/home/fotogeni/public_html/testegaleria/inc_features2.php');
echo "$photopostfeature";
?>
But I have the error
Parse error: syntax error, unexpected '<' in /home/fotogeni/public_html/testeforum/Sources/Load.php(1735) : eval()'d code(52) : eval()'d code on line 1
:(
Remove the opening and closing php tags:
<?php
?>
TP's php blocks/articles have these already included.
ZTN 8)
I´m Stupid
Works, thanks :)
Quote from: fermachado on November 19, 2008, 01:46:20 PM
I´m Stupid
No you are not.. You don't know until you have learnt it, now you have, you won't do it again.. If you do.. then you're stupid ;)
For future reference, try searching for the error:
Parse error: syntax error, unexpected '<' , for example, you'll probably find it's been discussed before.
Thanks,
Mi english it's very poor and I don't understand at first time the help from JPDENI .
I'm not remember to search this error :( sorry
Thanks again for your patience