Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 12208
Latest: Sousbi
New This Month: 16
New This Week: 8
New Today: 1
Stats
Total Posts: 39235
Total Topics: 6905
Most Online Today: 166
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 67
Total: 67

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

0 Members and 1 Guest are viewing this topic.

Offline usermike3969

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

Offline usermike3969

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« 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: [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="/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>

Offline jklapp

  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Random Image in Block?
« Reply #17 on: October 09, 2006, 11:17:30 pm »
in ssi.php

Find :
Code: [Select]
?>

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

Offline usermike3969

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« Reply #18 on: October 10, 2006, 08:24:11 am »
in ssi.php

Find :
Code: [Select]
?>

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

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

Offline jklapp

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

Offline SMFHacks

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

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« Reply #21 on: October 10, 2006, 11:17:42 am »
try this
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>';

Offline jklapp

  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Random Image in Block?
« Reply #22 on: October 10, 2006, 12:13:02 pm »
No.. That gives this error  :'(

Quote
Parse error: parse error in D:\Inetpub\akronsanctuary\smf\SSI.php on line 1642

Offline jklapp

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

Offline usermike3969

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« Reply #24 on: October 10, 2006, 12:17:48 pm »
sorry i fixed it i forgot the } at the end of the code
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>';
}

Offline usermike3969

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • mib4life
Re: Random Image in Block?
« Reply #25 on: October 10, 2006, 12:29:07 pm »
whats the url to your site if u dont mind me asking

Offline jklapp

  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Random Image in Block?
« Reply #26 on: October 10, 2006, 12:38:32 pm »
Wow... Thank you :) That really works nice :)

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. :)

Our website is www.akronsanctuary.com This is Enigma 2.0. The test site is not accessable from the net right now.

Offline Maya

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Random Image in Block?
« Reply #27 on: October 10, 2006, 04:15:55 pm »
I am trying to get this to go, without much luck.  ::)
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



Offline SMFHacks

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

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

 

Related Topics

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

+- Recent Topics

message editor pro by dan42101
October 19, 2018, 11:26:45 pm

multiple currencies bug by SMFHacks
October 19, 2018, 09:45:49 pm

Looking for ideas for next SMF Classifieds by SMFHacks
October 19, 2018, 04:41:48 pm

Turn off Download Stats? by SMFHacks
October 18, 2018, 12:12:28 pm

KARMA Badge by SMFHacks
October 17, 2018, 11:17:16 pm

remove the boards ? by SMFHacks
October 16, 2018, 03:08:00 pm

Upgraded to pro - some features not working? by SMFHacks
October 16, 2018, 10:21:38 am

SMF lottery mod by SMFHacks
October 13, 2018, 08:02:41 am

Error after adding Russian translation by SMFHacks
October 08, 2018, 04:10:41 pm

Adseller Pro 3.0 Released! by SMFHacks
October 06, 2018, 05:45:42 pm

Powered by EzPortal