Twitter SMFHacks Facebook SMFHacks SMFHacks.com
** Home Forum Index Hacks Products Login Register Search
Welcome, Guest. Please login or register.
May 18, 2013, 05:34:49 pm

Login with username, password and session length
Members
Total Members: 10757
Latest: DTroup
Stats
Total Posts: 32348
Total Topics: 5473
Online Today: 56
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 0
Guests: 33
Total: 33
+ 
|-+ 
| |-+ 
| | |-+ 
| | | |-+ 
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: 1 2 [3] 4 5 ... 8 Go Down Print
Author Topic: Random Image in Block?  (Read 78790 times)
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« Reply #30 on: October 12, 2006, 04:24:45 am »

what happen when u tried the linking codes Huh
Logged
xface
Inline PM Customer
*****
Offline Offline

Posts: 16


View Profile
« Reply #31 on: October 12, 2006, 12:05:35 pm »

fatal error, but I think I might have screwed something up there. I will try it again today now that I have a few hours of sleep under my belt. Grin

I will let you know how it turns out...
Logged
Maya
Inline PM Customer
*****
Offline Offline

Posts: 19


View Profile
« Reply #32 on: October 12, 2006, 01:33:24 pm »

I, understand code, but don't know how to write code, yet  Wink , so I am just content to get this working for now with 1 image...figure the rest out later

lol... not havin fun here...no biggie, just  trying this on a test site till I see something work.. Grin

heres what I have done..

added the code to the ssi.php

created a php block (thnx btw)

and heres what I get...

Quote
Fatal error: Cannot redeclare ssi_grandom() (previously declared in /home/talk/public_html/test/SSI.php:1595) in /home/talk/public_html/test/Sources/Load.php(1708) : eval()'d code(35) : eval()'d code on line 1

Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 10987


View Profile
« Reply #33 on: October 12, 2006, 01:41:33 pm »

What are you putting in the php block?
Logged
Maya
Inline PM Customer
*****
Offline Offline

Posts: 19


View Profile
« Reply #34 on: October 12, 2006, 02:14:36 pm »

 Roll Eyes...k..( sorry Im workin on about 10 different thing right now...)

I pasted the wrong code in...
(its ok btw, I have just finished a slew of nasty words dericted to self....lol)

now I have put the correct call in the php box

ssi_grandom(2);



I removed the 2 to just make it ();

(if no cat is defined will it just call from all categories ?)

but get a red x...

it is trying to call the image from http://mysite/gallery and I need it to call them from mysite/test/gallery...
Is that back in the ssi.php code I put in...?




Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« Reply #35 on: October 12, 2006, 03:04:40 pm »

r u using the last code i gave here ??
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 10987


View Profile
« Reply #36 on: October 12, 2006, 03:17:02 pm »

This is correct code you all should use
Code:
function ssi_galleryrandom()
{
global $scripturl,$db_prefix,$modSettings,$boardurl;

if(empty($modSettings['gallery_url']))
{
$modSettings['gallery_url'] = $boardurl . '/gallery/';
}

$request = db_query("SELECT thumbfilename,ID_PICTURE FROM {$db_prefix}gallery_pic GROUP BY thumbfilename ORDER BY RAND() LIMIT 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($request);
mysql_free_result($request);
echo' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><img src="',  $modSettings['gallery_url'] . $row['thumbfilename'] ,'" /></a>'

;}
Logged
xface
Inline PM Customer
*****
Offline Offline

Posts: 16


View Profile
« Reply #37 on: October 12, 2006, 03:30:32 pm »

yeah that is the correct code it works awesome.

What I liked about the other code was the linking codes. This would allow members of mine to host the photo at another forum, and in turn drag other visitor's to my site.....

I have not tryed the linking codes version posted earlier yet today, been to busy sleeping...LOL
Logged
Maya
Inline PM Customer
*****
Offline Offline

Posts: 19


View Profile
« Reply #38 on: October 12, 2006, 03:48:57 pm »

actually the code i had posted was
Code:
function ssi_grandom ($cat)
{
    global $scripturl,$modSettings,$db_prefix;
    $cat = (int) $cat;

    $request = db_query("SELECT thumbfilename, filename, ID_CAT, ID_PICTURE FROM {$db_prefix}gallery_pic WHERE ID_CAT = $cat GROUP BY thumbfilename ORDER BY RAND() LIMIT 1", __FILE__, __LINE__);
    $row = mysql_fetch_assoc($request);
    mysql_free_result($request);
    echo' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><img src="',$modSettings['gallery_url'], $row['thumbfilename'] ,'" /></a>';
}

(this code got the pics well the red x showing..

I just replaced it with the code u posted and i am back to

Quote
Fatal error: Call to undefined function: ssi_grandom() in /home/talk/public_html/test/Sources/Load.php(1708) : eval()'d code(35) : eval()'d code on line 1

phpbox with "ssi_grandom(); "

 Huh
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 10987


View Profile
« Reply #39 on: October 12, 2006, 03:50:26 pm »

If you use my code then you would put ssi_galleryrandom(); in the php box
Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« Reply #40 on: October 12, 2006, 04:00:17 pm »

Maya is what u wont to do is like what i have on my main page in the center at the bottem ??
Logged
Maya
Inline PM Customer
*****
Offline Offline

Posts: 19


View Profile
« Reply #41 on: October 12, 2006, 04:07:26 pm »

Perfect... Wink thank you...it works very well

Yes that is exactly what I want to do...a few adjustment for my site( and maybe without the info on bottom, but yes...

*btw thanks for the test for me... Wink
Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« Reply #42 on: October 12, 2006, 04:10:38 pm »

Code:
function ssi_g3random ()
{global $db_prefix, $scripturl, $txt, $context,$ID_MEMBER,$modSettings, $boarddir,$boardurl;
          echo'<table cellspacing="0" cellpadding="5" border="0" align="center" width="90%"><tr>';

         $request10 = db_query("SELECT z.ID_PICTURE, z.commenttotal, z.filesize, z.views, z.thumbfilename, z.title, z.ID_MEMBER, x.memberName, x.realName, z.date, z.description FROM {$db_prefix}gallery_pic as z, {$db_prefix}members AS x WHERE approved = 1 GROUP BY date ORDER BY RAND() DESC LIMIT 3", __FILE__, __LINE__);
          while ($row10 = mysql_fetch_assoc($request10))
          {
          echo'<td align="center" colspan="3"></br><a href="' . $scripturl . '?action=gallery;sa=view;id=' . $row10['ID_PICTURE'] . '"><img src="' . $modSettings['gallery_url'] . $row10['thumbfilename']  . '" /></a></br>';
         }
          mysql_free_result($request10);
          echo'</td></tr>';
          echo'</table></br>';
}

this is the code i used but mite not b the best way
Logged
Maya
Inline PM Customer
*****
Offline Offline

Posts: 19


View Profile
« Reply #43 on: October 12, 2006, 05:46:58 pm »

no dice...

back to parse error on fp

Parse error: syntax error, unexpected $end in /home/talk/public_html/test/Sources/Load.php(1708) : eval()'d code(35) : eval()'d code on line 1


when I changed this in the ssi,
I changed what i put in the php box to match

ssi_g3random ()
 
then back... hmmm
Logged
Jpg
Inline PM Customer
*****
Offline Offline

Posts: 25


I love cats they taste like chicken!!


View Profile WWW
« Reply #44 on: October 12, 2006, 06:58:15 pm »

I'll help everyone out. I modified SMF Hack's code and made it center when it a block.. No biggy.



USE THIS ONE
Code:
function ssi_galleryrandom()
{
global $scripturl,$db_prefix,$modSettings,$boardurl;

if(empty($modSettings['gallery_url']))
{
$modSettings['gallery_url'] = $boardurl . '/gallery/';
}

$request = db_query("SELECT thumbfilename,ID_PICTURE FROM

{$db_prefix}gallery_pic GROUP BY thumbfilename ORDER BY RAND() LIMIT 1", __FILE__,

__LINE__);
$row = mysql_fetch_assoc($request);
mysql_free_result($request);
echo' <center><a href="', $scripturl, '?action=gallery;sa=view;id=',

$row['ID_PICTURE'], '"><img src="',  $modSettings['gallery_url'] .

$row['thumbfilename'] ,'" /></a></center>'

;}

Put this in a PHP block.

Code:
ssi_galleryrandom();

Logged





Pages: 1 2 [3] 4 5 ... 8 Go Up Print 
« previous next »
Jump to:  

Recent
[May 16, 2013, 10:13:46 pm]

[May 15, 2013, 11:32:14 pm]

[May 15, 2013, 11:31:24 pm]

[May 12, 2013, 09:10:43 am]

[May 10, 2013, 03:49:55 am]

[May 07, 2013, 07:12:40 pm]

[May 07, 2013, 02:37:14 pm]

[May 06, 2013, 10:29:56 pm]

[May 04, 2013, 03:22:01 pm]

[May 04, 2013, 01:08:57 pm]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
TinyPortal v0.9.7 © Bloc
SMF and SimpleMachines are registered trademarks of Simple Machines. SMFHacks.com is not affiliated with nor endorsed by Simple Machines.
Page created in 1.349 seconds with 20 queries.