Twitter SMFHacks Facebook SMFHacks SMFHacks.com
** Home Forum Index Hacks Products Login Register Search
Welcome, Guest. Please login or register.
May 18, 2013, 03:10:46 am

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

Posts: 28


View Profile WWW
« Reply #15 on: October 04, 2006, 07:13:27 am »

is there a way to make it universal because i couldnt figger it out so that code only works for my site but if any one wont to use it just change all the www.mib4life.com:8080 to your site address
Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« Reply #16 on: October 04, 2006, 07:43:02 am »

nevermind i figgered it out i just forgot the a global lol heres the universal code
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="/gallery/', $row['thumbfilename'] ,'" /></a>';
 ?><script language="javascript" type="text/javascript">
<!--
function linkingcodes() {
  newwindow2=window.open('','name','height=350,width=800,scrollbars=yes');
  var tmp = newwindow2.document;
  tmp.write('<html><head><title>Linking codes</title>');
  tmp.write('');
  tmp.write('</head><body bgcolor="#000000"><center><font color="#FFFFFF">');
  tmp.write('HTML THUMB</br>&lt;img src="<?echo $modSettings['gallery_url'].$row['thumbfilename'];?>"&gt; ');
  tmp.write('</br></br>HTML</br>&lt;img src="<?echo $modSettings['gallery_url'].$row['filename']; ?>"&gt;');
  tmp.write('</br></br>BBC THUMB</br>[img]<?echo $modSettings['gallery_url'].$row['thumbfilename'];?>[/img]');
  tmp.write('</br></br>BBC</br>[img]<?echo $modSettings['gallery_url'].$row['filename']; ?>[/img]');
  tmp.write('</font></center></body></html>');
  tmp.close();
}
// -->
</script><center><form>
</br><input type="button" onClick="return linkingcodes()" value="Linking codes!">
</form></center>
Logged
jklapp
Inline PM Customer
*****
Offline Offline

Posts: 45


View Profile
« Reply #17 on: October 09, 2006, 11:17:30 pm »

in ssi.php

Find :
Code:
?>


I'm confused... Could you explain this in more detail? ... Thank you Smiley
Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« Reply #18 on: October 10, 2006, 08:24:11 am »

in ssi.php

Find :
Code:
?>


I'm confused... Could you explain this in more detail? ... Thank you Smiley

if u look in your forums dir and find ssi.php and open it in a editor or notepad at the very bottem u will find ?> then place the code i gave right befor it
Logged
jklapp
Inline PM Customer
*****
Offline Offline

Posts: 45


View Profile
« Reply #19 on: October 10, 2006, 10:41:08 am »

For some reason it's not working... I'm not getting a picture in the block (only an empty space where the image should be) But if I click-on the empty space, it does take me to the image that should be showing.
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 10987


View Profile
« Reply #20 on: October 10, 2006, 10:50:31 am »

Yeah that is not the full random image. I have a good one in the paid section.
This one is missing the path to the images if you never set it.
Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« Reply #21 on: October 10, 2006, 11:17:42 am »

try this
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>';
Logged
jklapp
Inline PM Customer
*****
Offline Offline

Posts: 45


View Profile
« Reply #22 on: October 10, 2006, 12:13:02 pm »

No.. That gives this error  Cry

Quote
Parse error: parse error in D:\Inetpub\akronsanctuary\smf\SSI.php on line 1642
Logged
jklapp
Inline PM Customer
*****
Offline Offline

Posts: 45


View Profile
« Reply #23 on: October 10, 2006, 12:15:57 pm »

What I need to do is talk to the Church people and get someone to donate this mod for the Church site Smiley
Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« Reply #24 on: October 10, 2006, 12:17:48 pm »

sorry i fixed it i forgot the } at the end of the code
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>';
}
Logged
usermike3969
Inline PM Customer
*****
Offline Offline

Posts: 28


View Profile WWW
« Reply #25 on: October 10, 2006, 12:29:07 pm »

whats the url to your site if u dont mind me asking
Logged
jklapp
Inline PM Customer
*****
Offline Offline

Posts: 45


View Profile
« Reply #26 on: October 10, 2006, 12:38:32 pm »

Wow... Thank you Smiley That really works nice Smiley

I'm thinking about changing our Church site from Enigma 2.0 to Tiny Portal, so I've been testing mods.

Right now I'm using Gallery 2, but I'm starting to like this Gallery. Smiley

Our website is www.akronsanctuary.com This is Enigma 2.0. The test site is not accessable from the net right now.
Logged
Maya
Inline PM Customer
*****
Offline Offline

Posts: 19


View Profile
« Reply #27 on: October 10, 2006, 04:15:55 pm »

I am trying to get this to go, without much luck.  Roll Eyes
2 questions, if I may...

I got the code in the ssi.php okay... I would like to run this in a front page block  ( using tp.95 and rc3) ,

1. Do I create a 'script block', and paste the code in there, ( in an ssi block there is no option for the code snippet ) ?
In other words... what type of block should I create?

2. If I wanted to change from just 1 image to say a block in the center showing 3 or 4...is this as simple as instead of 'Limit_1' in the code to say 'Limit_3' ?

tia


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

Posts: 10987


View Profile
« Reply #28 on: October 10, 2006, 04:42:05 pm »

1. it would be a php block.

2. Very close that is part of it but you need to add a loop as well.
Logged
xface
Inline PM Customer
*****
Offline Offline

Posts: 16


View Profile
« Reply #29 on: October 12, 2006, 03:42:46 am »

so cool! those linking codes I could not get to work, but hell of an idea!!! thanks for this code, its helped alot!!!
Logged
Pages: 1 [2] 3 4 ... 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.303 seconds with 20 queries.