SimplePortal
Customization => Custom Coding => Topic started by: earthview.nl on December 18, 2009, 04:05:01 AM
-
Hi,
do you now if it is possible if someone click on a picture that the link navigation send him to the topic.
Many Thanks,
Michael
-
Moved to the Custom Coding board, this request is more of a minor alteration, rather than an entire new block request.
What version of SMF are you using?
-
Hi Nathaniel,
i use 1.1.11 and i have SimplePortal 2.2.2
Maik ;)
-
Wow, SP 2.2.2, I would strongly recommend that you upgrade to the latest version of SimplePortal.
The Recent Attachments block in SP 2.2.2 doesn't show any pictures of attachments, so I am not sure what you are referring to.
-
I have almost the same problem. The "last picture"block show the pic, but it never gives a link to the topic. (SMF 2 RC2, SP 2.3.1)... It must be nice, when under the number of downloads and the author-name stand "link", and when somebody klick on it, he comes to the forum-post for this attachment.
And 1 question more: I use the "Highslide Image Viewer"-Mod (Java Lightbox) is there anyway to make this mod working with the SP 2.3.1 ?
thank you...
-
Same demand, does anyone now how to add a link to the topic the image has come from?
SMF 1.1.11 |
SimplePortal 2.3.1
-
I've searched for an answer for the past few days. Still cannot find how to link an attachment which is in the recent attachment block to the post it was attached to.
-
Hello !
I've the same request...
In my case i have a block showing the last pictures attached (Recent Image Attachments) but when i click over the picture, SP link to:
http://www.mundomustang.com/forum/index.php?action=dlattach;topic=7828.0;attach=1075;image (original Size Image)
But I need link to:
http://www.mundomustang.com/forum/index.php?topic=7828.0 (Forum Post)
I'm using SMF 1.1.11 and SimplePortal 2.3.1
thanks in advance
-
For both SMF versions:
Sources/PortalBlocks.php
<a href="' . $item['file']['href'] . '">
<a href="' . $item['topic']['href'] . '">
-
Thanks [SiNaN]
Excellent. That's all i need.
-
Thank you a lot !
Its working now.
@[SiNaN]: You have a solution, that i can use the funtion of the "Highslide Image Viewer"-Mod in the Simple Portal ? I mean: when i click on the picture (Recent Image Block), its open with this "javafunction Lightbox" ???
-
for smf SMF 2.0 RC2
$attachments = ssi_recentAttachments(10, array('jpg', 'png', 'gif', 'bmp'), 'array');
echo '
<table style="border: 0; margin: 0 auto;">
<tr>
<td>
<ul style="float: right; width: 100%;">';
foreach ($attachments as $item)
echo '
<li class="windowbg2" style="text-align: center; width: 230px; height: 230px; line-height: 1.4em; border: 1px #ededed solid; padding: 0px; float: right;">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
<tr>
<td class="windowbg2" width="100%" colspan="2">
', $item['file']['image']['link'], '<br />
</td>
</tr>
<tr>
<td class="windowbg2" width="100%" colspan="2" height="40">
<b>
<font size="3" face="Arabic Transparent">', $item['topic']['link'], '</font></b><br />
</td>
</tr>
<tr>
<td class="windowbg2" width="50%">
','<font size="1">Downloads: </font>', $item['file']['downloads'], '<br />
</td>
<td width="50%">
', '<font size="1">By:</font> ', $item['member']['link'], '
</td>
</tr>
</table><br>
</li>';
echo '
</ul>
</td>
</tr>
</table>';
for smf 1.1.
global $db_prefix, $modSettings, $scripturl, $txt, $settings;
$boards = boardsAllowedTo('view_attachments');
if (empty($boards))
return array();
elseif ($boards[0] == 0)
$boards = '';
else
$boards = ' AND m.ID_BOARD IN (' . implode(',', $boards) . ')';
$limit = empty($parameters[0]) ? 12 : (int) $parameters[0];
$request = db_query("
SELECT
att.ID_ATTACH, att.ID_MSG, att.filename, IFNULL(att.size, 0) AS filesize, att.downloads, mem.ID_MEMBER,
IFNULL(mem.realName, m.posterName) AS posterName, m.ID_TOPIC, m.subject, t.ID_BOARD, m.posterTime,
att.width, att.height" . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? "" : ", IFNULL(thumb.ID_ATTACH, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height") . "
FROM {$db_prefix}attachments AS att
INNER JOIN {$db_prefix}messages AS m ON (m.ID_MSG = att.ID_MSG)
INNER JOIN {$db_prefix}topics AS t ON (t.ID_TOPIC = m.ID_TOPIC)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? "" : "
LEFT JOIN {$db_prefix}attachments AS thumb ON (thumb.ID_ATTACH = att.ID_THUMB)") . "
WHERE att.attachmentType = 0
AND att.width != 0
$boards
ORDER BY att.ID_ATTACH DESC
LIMIT $limit", __FILE__, __LINE__);
$items = array();
while ($row = mysql_fetch_assoc($request))
{
$filename = preg_replace('~&#(\\d{1,7}|x[0-9a-fA-F]{1,6});~', '&#\\1;', htmlspecialchars($row['filename']));
$items[$row['ID_ATTACH']] = array(
'member' => array(
'id' => $row['ID_MEMBER'],
'name' => $row['posterName'],
'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>',
),
'file' => array(
'filename' => $filename,
'filesize' => round($row['filesize'] /1024, 2) . $txt['smf211'],
'downloads' => $row['downloads'],
'href' => $scripturl . '?action=dlattach;topic=' . $row['ID_TOPIC'] . '.0;attach=' . $row['ID_ATTACH'],
'link' => ' <a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a>',
'is_image' => !empty($row['width']) && !empty($row['height']) && !empty($modSettings['attachmentShowImages']),
),
'topic' => array(
'id' => $row['ID_TOPIC'],
'subject' => $row['subject'],
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'],
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'] . '">' . $row['subject'] . '</a>',
'time' => timeformat($row['posterTime']),
),
);
if ($items[$row['ID_ATTACH']]['file']['is_image'])
{
$id_thumb = empty($row['ID_THUMB']) ? $row['ID_ATTACH'] : $row['ID_THUMB'];
$items[$row['ID_ATTACH']]['file']['image'] = array(
'id' => $id_thumb,
'width' => $row['width'],
'height' => $row['height'],
'img' => '<img src="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0;attach=' . $row['ID_ATTACH'] . ';image" alt="' . $row['subject'] . '" />',
'thumb' => '<img src="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0;attach=' . $id_thumb . ';image" alt="' . $row['subject'] . '" />',
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] ,
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0"><img src="' . $scripturl . '?action=dlattach;topic=' . $row['ID_TOPIC'] . '.0;attach=' . $id_thumb . ';image" alt="' . $row['subject'] . '"' . (empty($row['ID_THUMB']) ? ' width="210" height="240"' : '') . ' /></a>',
);
}
}
mysql_free_result($request);
echo '
<table style="border: 0; margin: 0 auto;">
<tr>
<td>
<ul style="float: right; width: 100%;">';
foreach ($items as $item)
echo '
<li class="windowbg2" style="text-align: center; width: 230px; line-height: 1.4em; border: 1px #ededed solid; padding: 0px; float: right;">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
<tr>
<td class="windowbg2" width="100%" colspan="2">
', $item['file']['image']['link'], '<br />
</td>
</tr>
<tr>
<td class="windowbg2" width="100%" colspan="2" height="40">
<b>
<font size="3" face="Arabic Transparent">', $item['file']['link'], '</font></b><br />
</td>
</tr>
<tr>
<td class="windowbg2" width="50%">
','<font size="1">مرات التحميل: </font>', $item['file']['downloads'], '<br />
</td>
<td width="50%">
', '<font size="1">بواسطة:</font> ', $item['member']['link'], '
</td>
</tr>
</table><br>
</li>';
echo '
</ul>
</td>
</tr>
</table>';
-
samozin, what are those codes for exactly?
-
they display the recent image attached linked to the topic
demo
www.salamoz.com
-
There is already a block in SimplePortal that displays recent attachment images and with that little edit above I provided, you can make it link to topics instead of images.
-
There is already a block in SimplePortal that displays recent attachment images and with that little edit above I provided, you can make it link to topics instead of images.
ummm on smf 2.x i couldnt make the images linked to the topic .
i just added its topic title linked to the topic
i think i need to ssi.php and see what going there can give alit help in that issue
-
Can you elaborate on what you mean? I'm not sure how we can help you since you seem to be using a different portal mod.
-
u know iam big fan of simple portal but iam already stuck with felblog
my users have their blogs on my site .that felblog not supported any more but supported only with portamx portal so i had to use it :(
-
I see. Of course, it is completely up to you which mod to you. It's just that you would probably get a better support at their support forum though.
-
ok thanx but that wont make me stop loving the simpleportal :)
-
@samozin:
Hey, great, you have a Java-Lightbox-Function on your Portal.... !
How you was doing this ? I was trying to add the "Highslide"-Mod to the Portal, but it is not working for me (maybe i am too blond)
-
@samozin:
Hey, great, you have a Java-Lightbox-Function on your Portal.... !
How you was doing this ? I was trying to add the "Highslide"-Mod to the Portal, but it is not working for me (maybe i am too blond)
actully i did not do any thing its already included with the portal iam using isnt it great i hope simpleportal include it so soon ha ...?
-
For both SMF versions:
Sources/PortalBlocks.php
<a href="' . $item['file']['href'] . '">
<a href="' . $item['topic']['href'] . '">
I replaced 'file' with 'topic' as mentioned above but no change was made. Same as i changed 'file' with 'post', still nothing happens... when i click the image, is opening as attachment.
There is something else i should change? i'm using SMF 2 RC3 and Simple Portal 2.3.1.
Thanks!
-
Can you attach your edited file here?
-
Sure thing, please see the attachment.
Meanwhile i noticed that the url look like domainname/forum/dlattach/attach,51/image/path_to_topic.html. I guess there is a problem related to Simple SEF mod i'm using.
There is a solution for this or should i ask for support in the mod's topic?
Thanks!
-
Are you using Recent Image Attachments block or Recent Attachments block?
-
Recent image attachments
-
Ah, you mean you want the image itself to link to the topic.
', $item['file']['image']['link'], '
<a href="' . $item['topic']['href'] . '">', $item['file']['image']['thumb'], '</a>
-
Excelent! It's working now. Many thanks! :)
-
You're welcome. ;)
-
Ah, you mean you want the image itself to link to the topic.
', $item['file']['image']['link'], '
<a href="' . $item['topic']['href'] . '">', $item['file']['image']['thumb'], '</a>
Hi Sinan,
thanks a lot, if i use this code, they will show the images in orginal size , the resizes doens't work.
Gr,
Maik
-
You can try this then:
', $item['file']['image']['link'], '
<a href="' . $item['topic']['href'] . '">', str_replace('<img', '<img width="100"', $item['file']['image']['thumb']), '</a>
-
Yes :D Thanks
-
For both SMF versions:
Sources/PortalBlocks.php
<a href="' . $item['file']['href'] . '">
<a href="' . $item['topic']['href'] . '">
Hi will this work on RC3 & SP2.3.2
do i edit index.php in forum root
thanks in advance
-
It should work. As stated in the post, you need to edit the 'Sources/PortalBlocks.php' file.
-
ok thanks will give it a try
-
thanks worked a treat i needed to use Reply #27
like it very much i only stumbled across this post SP rocks
-
just look at my site www.salamoz.com
i have edited both ssi.php and the portalblock.php one
i have
// Images.
if ($attachments[$row['id_attach']]['file']['is_image'])
{
$id_thumb = empty($row['id_thumb']) ? $row['id_attach'] : $row['id_thumb'];
$attachments[$row['id_attach']]['file']['image'] = array(
'id' => $id_thumb,
'width' => $row['width'],
'height' => $row['height'],
'img' => '<img src="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'] . ';image" alt="' . $filename . '" />',
'thumb' => '<img src="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $id_thumb . ';image" alt="' . $filename . '" />',
'href' => $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $id_thumb . ';image',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0"><img src="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $id_thumb . ';image" alt="' . $row['subject'] . '"' . (empty($row['ID_THUMB']) ? ' width="210" height="240"' : '') . ' /></a>',
);
}
}
$smcFunc['db_free_result']($request);
that is in the ssi.php
and i have this
<a href="' . $item['topic']['href'] . '">' . $item['topic']['link'] . '</a><br />' : ''), '
in portalblck.php line 3193
i think thats the best thing for adding the latest topics with the attached images the images linked to topic and the title of the topic above it
any one can help i need to add auto scrolling for that ?
-
O.k. I have it working now but the images are still actually i want the images scrolling (moving) please can you give me the code in the script to make the images moving?
Thanks in advance!!
-
You can try this then:
', $item['file']['image']['link'], '
<a href="' . $item['topic']['href'] . '">', str_replace('<img', '<img width="100"', $item['file']['image']['thumb']), '</a>
thanks... it works. :nervous-happy:
-
For both SMF versions:
Sources/PortalBlocks.php
<a href="' . $item['file']['href'] . '">
<a href="' . $item['topic']['href'] . '">
I have upgraded to SimplePortal 2.3.4 and im having some issues with the above code. It's not making the thumbs link to the actual post.
Should the above code still work for linking the thumbs to the post in 2.3.4?
thanks
-
You can try this then:
', $item['file']['image']['link'], '
<a href="' . $item['topic']['href'] . '">', str_replace('<img', '<img width="100"', $item['file']['image']['thumb']), '</a>
thanks... it works. :nervous-happy:
oppps, NM, that's the wrong code. It would have helped if i read the whole thread. LOL
thanks
-
hello ... sorry for bumping old topic... but i need help.. is there a way to make recent image attachment block in form of table???? like CSS??? i have no idea regarding coding.. and just modified this block to show topic too..Please help ....
-
hi.. it is working good... but i want to customize it to show only 10 posts in simple portal how can i do it... and another problem is when the topic name gose biger it looks disgusting can you help me with it too.... plz help....
-
RandomRidoy,
Well both blocks come with SimplePortal by default now (at least as of 2.3.6, don't know exactly when they were introduced), so you should have a look in the relative settings, it should be possible to customize the number of things easily in the block settings ;)
And also provide a link to your site, so that I could check that topic title issue as well. In the meantime you could try to add word-wrap: break-word;
into the "Custom CSS styles" text field for the "Body" of your block, it should work, but could look ugly anyway, that's why I need a link :)
Regards
-
hi there... when i post 2 topic... but it show 1 - 2.. but i want to show the last topic in first... like this...
(http://i.imgur.com/fYyFkqn.png)
how can i do this....???
-
Which block are you using? There are recent attachments and recent images blocks built-in into SimplePortal already.
-
i am using.. Bottom Block... Custom PHP
-
There are recent attachments and recent images blocks built-in into SimplePortal already.
I don't know how to say it differently, I already said this 3 times...
-
for smf SMF 2.0 RC2
$attachments = ssi_recentAttachments(10, array('jpg', 'png', 'gif', 'bmp'), 'array');
echo '
<table style="border: 0; margin: 0 auto;">
<tr>
<td>
<ul style="float: right; width: 100%;">';
foreach ($attachments as $item)
echo '
<li class="windowbg2" style="text-align: center; width: 230px; height: 230px; line-height: 1.4em; border: 1px #ededed solid; padding: 0px; float: right;">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
<tr>
<td class="windowbg2" width="100%" colspan="2">
', $item['file']['image']['link'], '<br />
</td>
</tr>
<tr>
<td class="windowbg2" width="100%" colspan="2" height="40">
<b>
<font size="3" face="Arabic Transparent">', $item['topic']['link'], '</font></b><br />
</td>
</tr>
<tr>
<td class="windowbg2" width="50%">
','<font size="1">Downloads: </font>', $item['file']['downloads'], '<br />
</td>
<td width="50%">
', '<font size="1">By:</font> ', $item['member']['link'], '
</td>
</tr>
</table><br>
</li>';
echo '
</ul>
</td>
</tr>
</table>';
can i replace attachments with bbc code...??? if i can... can you help me with it....
-
for smf SMF 2.0 RC2
$attachments = ssi_recentAttachments(10, array('jpg', 'png', 'gif', 'bmp'), 'array');
echo '
<table style="border: 0; margin: 0 auto;">
<tr>
<td>
<ul style="float: right; width: 100%;">';
foreach ($attachments as $item)
echo '
<li class="windowbg2" style="text-align: center; width: 230px; height: 230px; line-height: 1.4em; border: 1px #ededed solid; padding: 0px; float: right;">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
<tr>
<td class="windowbg2" width="100%" colspan="2">
', $item['file']['image']['link'], '<br />
</td>
</tr>
<tr>
<td class="windowbg2" width="100%" colspan="2" height="40">
<b>
<font size="3" face="Arabic Transparent">', $item['topic']['link'], '</font></b><br />
</td>
</tr>
<tr>
<td class="windowbg2" width="50%">
','<font size="1">Downloads: </font>', $item['file']['downloads'], '<br />
</td>
<td width="50%">
', '<font size="1">By:</font> ', $item['member']['link'], '
</td>
</tr>
</table><br>
</li>';
echo '
</ul>
</td>
</tr>
</table>';
hi, i am using this php code in my simple portal.... http://i.imgur.com/whWdx91.png
but there is a problem... when any Guest visit my site its show nothing... i allow everyone to view this.. but stil it showing nothing....
http://i.imgur.com/p8WkAaZ.png
-
Most likely because guests are not allowed to view recent topics :P I believe it's info center permission, but I could be wrong. didn't use it for a long time. Give it a try!
Regards