Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4257
Latest: Alex998.
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43295
Total Topics: 7523
Most Online Today: 241
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 219
Total: 219

Author Topic: Random Image in Block?  (Read 150704 times)

0 Members and 1 Guest are viewing this topic.

Offline usermike3969

  • Member
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« Reply #30 on: October 12, 2006, 04:24:45 am »
what happen when u tried the linking codes ???

Offline xface

  • Bad Emails DO NOT EMAIL
  • Member
  • *
  • Posts: 16
    • View Profile
Re: Random Image in Block?
« 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. ;D

I will let you know how it turns out...

Offline Maya

  • Member
  • *
  • Posts: 19
    • View Profile
Re: Random Image in Block?
« Reply #32 on: October 12, 2006, 01:33:24 pm »
I, understand code, but don't know how to write code, yet  ;) , 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.. ;D

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


Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Random Image in Block?
« Reply #33 on: October 12, 2006, 01:41:33 pm »
What are you putting in the php block?
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline Maya

  • Member
  • *
  • Posts: 19
    • View Profile
Re: Random Image in Block?
« Reply #34 on: October 12, 2006, 02:14:36 pm »
 ::)...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...?





Offline usermike3969

  • Member
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« Reply #35 on: October 12, 2006, 03:04:40 pm »
r u using the last code i gave here ??

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Random Image in Block?
« Reply #36 on: October 12, 2006, 03:17:02 pm »
This is correct code you all should use
Code: [Select]
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>'

;}
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline xface

  • Bad Emails DO NOT EMAIL
  • Member
  • *
  • Posts: 16
    • View Profile
Re: Random Image in Block?
« 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

Offline Maya

  • Member
  • *
  • Posts: 19
    • View Profile
Re: Random Image in Block?
« Reply #38 on: October 12, 2006, 03:48:57 pm »
actually the code i had posted was
Code: [Select]
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(); "

 ???

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Random Image in Block?
« 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
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline usermike3969

  • Member
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« 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 ??

Offline Maya

  • Member
  • *
  • Posts: 19
    • View Profile
Re: Random Image in Block?
« Reply #41 on: October 12, 2006, 04:07:26 pm »
Perfect... ;) 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... ;)

Offline usermike3969

  • Member
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« Reply #42 on: October 12, 2006, 04:10:38 pm »
Code: [Select]
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

Offline Maya

  • Member
  • *
  • Posts: 19
    • View Profile
Re: Random Image in Block?
« 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

Offline Jpg

  • Member
  • *
  • Posts: 25
  • I love cats they taste like chicken!!
    • View Profile
    • InflameHq
Re: Random Image in Block?
« 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: [Select]
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: [Select]
ssi_galleryrandom();





 

Related Topics

  Subject / Started by Replies Last post
4 Replies
6143 Views
Last post June 18, 2010, 09:18:00 am
by dvera
2 Replies
9302 Views
Last post October 15, 2010, 04:03:02 pm
by Rafferty
1 Replies
5400 Views
Last post October 16, 2016, 12:12:51 pm
by exit
5 Replies
5370 Views
Last post July 12, 2017, 03:45:34 pm
by donk
8 Replies
7028 Views
Last post December 04, 2017, 09:41:20 pm
by Boomslanger

+- Recent Topics

Please Help! by SMFHacks
April 17, 2024, 08:04:55 am

Rate own images by fvlog19
April 11, 2024, 10:56:53 am

Tidy Child Boards on 2.1.4 by SMFHacks
April 04, 2024, 03:54:12 pm

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
March 30, 2024, 12:41:08 pm

Can't DROP 'id_member'; check that column/key exists Datei: by SMFHacks
March 30, 2024, 11:58:20 am

No thumbnails on new uploads by Tonyvic
March 29, 2024, 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

Powered by EzPortal