Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4255
Latest: andreios
New This Month: 3
New This Week: 1
New Today: 0
Stats
Total Posts: 43259
Total Topics: 7518
Most Online Today: 201
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 171
Total: 171

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

0 Members and 2 Guests are viewing this topic.

Offline usermike3969

  • Member
  • *
  • 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

  • Member
  • *
  • 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

  • Member
  • *
  • 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

  • Member
  • *
  • 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

  • Member
  • *
  • 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: 16436
    • 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

  • Member
  • *
  • 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

  • Member
  • *
  • 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

  • Member
  • *
  • 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

  • Member
  • *
  • 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

  • Member
  • *
  • 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

  • Member
  • *
  • 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

  • Member
  • *
  • 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: 16436
    • 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

  • Bad Emails DO NOT EMAIL
  • Member
  • *
  • 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
6065 Views
Last post June 18, 2010, 09:18:00 am
by dvera
2 Replies
9266 Views
Last post October 15, 2010, 04:03:02 pm
by Rafferty
1 Replies
5380 Views
Last post October 16, 2016, 12:12:51 pm
by exit
5 Replies
5328 Views
Last post July 12, 2017, 03:45:34 pm
by donk
8 Replies
6986 Views
Last post December 04, 2017, 09:41:20 pm
by Boomslanger

+- Recent Topics

No thumbnails on new uploads by SMFHacks
March 27, 2024, 02:10:41 pm

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

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Gallery icon as last added image by fvlog19
February 01, 2024, 01:04:56 pm

Powered by EzPortal