collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 421
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: A Better "SMF ARTICLES" Block  (Read 40803 times)

0 Members and 1 Guest are viewing this topic.

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
A Better "SMF ARTICLES" Block
« on: May 04, 2009, 09:02:08 AM »
There is a simple block somewhere in the "custom coding" forum related to SMF Articles. It's great but It's very simple.

To that code, I added some customization. Hope you like it :)

Code: (SMF 2.0) [Select]
global $smcFunc, $scripturl;
isAllowedTo('view_articles');
$dbresult = $smcFunc['db_query']('', "
SELECT a.ID_ARTICLE, a.title
FROM {db_prefix}articles AS a
WHERE a.approved = 1
ORDER BY RAND()
LIMIT 5
");

echo'
<div class="smalltext" style="text-align: center; color: #216095;">
   <strong>5 Random Articles</strong>
</div>
   <hr />';

echo'
<table>';
while ($row = $smcFunc['db_fetch_assoc']($dbresult))
{
echo '
<tr>
<td align="center">', sp_embed_image('topic'), ' </td>
<td><span class="smalltext"><a href="' . $scripturl . '?action=articles;sa=view;article=' . $row['ID_ARTICLE'] . '">' . $row['title'] . '</a></span> </td>
</tr>';
}
$smcFunc['db_free_result']($dbresult);

echo'
</table><hr />
', sp_embed_image('dot'), ' <span class="smalltext"><b><a href="' . $scripturl . '?action=articles">Read ALL Articles</a></b></span>';

Code: (SMF 1.1.X) [Select]
global $scripturl, $db_prefix;
isAllowedTo('view_articles');
$dbresult = db_query("
SELECT a.ID_ARTICLE, a.title
FROM {$db_prefix}articles AS a
WHERE a.approved = 1
ORDER BY RAND()
LIMIT 5", __FILE__, __LINE__);

echo'
<div class="smalltext" style="text-align: center; color: #216095;">
   <strong>5 Random Articles</strong>
</div>
   <hr />';

echo'
<table>';
while ($row = mysql_fetch_assoc($dbresult))
{
echo '
<tr>
<td align="center">', sp_embed_image('topic'), ' </td>
<td><span class="smalltext"><a href="' . $scripturl . '?action=articles;sa=view;article=' . $row['ID_ARTICLE'] . '">' . $row['title'] . '</a></span></td>
</tr>';
}
mysql_free_result($dbresult);

echo'
</table><hr />
', sp_embed_image('dot'), ' <span class="smalltext"><b><a href="' . $scripturl . '?action=articles">Read ALL Articles</a></b></span>';

Edited: This document was successfully checked as XHTML 1.0 Transitional!
« Last Edit: July 05, 2011, 03:28:22 PM by Blue »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: A Better "SMF ARTICLES" Block
« Reply #1 on: May 04, 2009, 11:52:56 AM »
Looks cool, good job!
And slowly, you come to realize... It's all as it should be...

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: A Better "SMF ARTICLES" Block
« Reply #2 on: May 04, 2009, 12:08:55 PM »
Thanks ;) Next block is going to be an Admin Block eheh ;D
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: A Better "SMF ARTICLES" Block
« Reply #3 on: May 04, 2009, 12:37:54 PM »
That sounds great. Looking forward to seeing that.
And slowly, you come to realize... It's all as it should be...

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [BLOCK] A Better "SMF ARTICLES" Block
« Reply #4 on: May 04, 2009, 05:32:52 PM »
It's done eheh :P

See for yourself:
http://simpleportal.net/index.php?topic=2206.0
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: A Better "SMF ARTICLES" Block
« Reply #5 on: May 04, 2009, 05:49:25 PM »
Moved to the "Blocks and Modifications" board.

One thing that you could do, is use the 'sp_embed_image' function to put in the topic images. Like the code below:

Code: [Select]
', sp_embed_image('topic'), '
That function will load any images in the 'sp' image folder. :)
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: A Better "SMF ARTICLES" Block
« Reply #6 on: May 04, 2009, 06:05:42 PM »
That's a good suggestion but if I put:

Code: [Select]
', sp_embed_image('dot'), ' 

The "dot" will be a random dot right? I'm asking because I saw that code in your "Who's online block"

And I can't try by myself since I'm using SP 2.1.1 (I just need the php block :P)

Even though, I'll update the block and replace for that code ;) Thanks LHVWB
« Last Edit: May 04, 2009, 06:08:49 PM by Blue »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline fotografo74

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2 RC1-1
  • SP Version: 2.3
Re: A Better "SMF ARTICLES" Block
« Reply #7 on: May 07, 2009, 07:04:51 AM »
Thanks for sharing this :-)
I have problem , i have this error:
Code: [Select]
Parse error: syntax error, unexpected '<' in /home/macrofor/public_html/Sources/SPortal2.php(3174) : eval()'d code on line 17

I have SMF2 RC1 and SP 2.2

My forum: www..macroforum.org

Thanks for help!
Antonio

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: A Better "SMF ARTICLES" Block
« Reply #8 on: May 07, 2009, 07:21:51 AM »
I forgot an "echo'", sorry about that :-[

I've updated the code in the first post. Try it now and tell me if it works :nervous-happy:
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline fotografo74

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2 RC1-1
  • SP Version: 2.3
Re: A Better "SMF ARTICLES" Block
« Reply #9 on: May 07, 2009, 10:02:54 AM »
I forgot an "echo'", sorry about that :-[

I've updated the code in the first post. Try it now and tell me if it works :nervous-happy:
Thanks, it works now!
Thanks!
Antonio

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: A Better "SMF ARTICLES" Block
« Reply #10 on: May 07, 2009, 10:59:52 PM »
I'm glad I helped you ;)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Hellan

  • Semi Newbie
  • *
  • Posts: 12
  • SMF Version: 1.1.10
  • SP Version: 2.2.2
Re: A Better "SMF ARTICLES" Block
« Reply #11 on: May 08, 2009, 03:04:28 PM »
Hi Blue,
Any chance of making this available for smf 1.1.8?
I would LOVE this mod on my portal
Thanks
Hellan

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: A Better "SMF ARTICLES" Block
« Reply #12 on: May 08, 2009, 08:01:45 PM »
Maybe :P I just need to see the things I need to change. 

hum... I'll try
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: A Better "SMF ARTICLES" Block
« Reply #13 on: May 08, 2009, 10:06:34 PM »
Try this:
Code: [Select]
global $scripturl, $db_prefix;
isAllowedTo('view_articles');
$dbresult = db_query("
SELECT a.ID_ARTICLE, a.title
FROM {$db_prefix}articles AS a
WHERE a.approved = 1
ORDER BY RAND()
LIMIT 5
");

echo'
<div class="smalltext" style="text-align: center; color: #216095;">
   <strong>5 Random Articles</strong>
</div>
   <hr />';

echo'
<table>';
while ($row = mysql_fetch_assoc($dbresult))
{
echo '
<tr>
<td align="center">', sp_embed_image('topic'), ' </td>
<td><span class="smalltext"><a href="' . $scripturl . '?action=articles;sa=view;article=' . $row['ID_ARTICLE'] . '">' . $row['title'] . '</a></span></td>
</tr>';
}
mysql_free_result($dbresult);

echo'
</table>
<hr>
', sp_embed_image('dot'), ' <span class="smalltext"><font color="#000000"><b><a href="' . $scripturl . '?action=articles">Read ALL Articles</a></b></span>';
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Hellan

  • Semi Newbie
  • *
  • Posts: 12
  • SMF Version: 1.1.10
  • SP Version: 2.2.2
Re: A Better "SMF ARTICLES" Block
« Reply #14 on: May 09, 2009, 07:19:16 AM »
Thank you works great

techprince

  • Guest
Re: A Better "SMF ARTICLES" Block
« Reply #15 on: May 10, 2009, 05:29:28 PM »
i modified the code a little, but getting missing arguments 2 and 3 for db_query()

Code: [Select]
global $scripturl, $db_prefix;
isAllowedTo('view_articles');
$dbresult = db_query("
SELECT a.ID_ARTICLE, a.title, a.commenttotal
FROM {$db_prefix}articles AS a
WHERE a.approved = 1
ORDER BY a.date DESC
LIMIT 8
");

echo'
<table>';
while ($row = mysql_fetch_assoc($dbresult))
{
echo '
<tr>
<td align="center" style="padding:6px;">', sp_embed_image('topic'), ' </td>
<td><span class="smalltext"><a href="' . $scripturl . '?action=articles;sa=view;article=' . $row['ID_ARTICLE'] . '">' . $row['title'] . '  (' . $row['commenttotal'] . ')</a></span></td>
</tr>';
}
mysql_free_result($dbresult);

echo'
</table>
<hr>
', sp_embed_image('dot'), ' <span class="smalltext"><font color="#000000"><b><a href="' . $scripturl . '?action=articles">Read ALL Reviews</a></b></span>';
« Last Edit: May 10, 2009, 05:44:50 PM by techprince »

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: A Better "SMF ARTICLES" Block
« Reply #16 on: May 10, 2009, 05:50:46 PM »
Hum... The code seams correct.

What do you mean by: "getting missing arguments 2 and 3 for db_query()"? :0
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

techprince

  • Guest
Re: A Better "SMF ARTICLES" Block
« Reply #17 on: May 10, 2009, 06:02:14 PM »
I am getting these errors in Forum Log, though the output is clean.

2: Missing argument 2 for db_query(), called in /Sources/SPortal1-1.php(3244) : eval()'d code on line 9 and defined
File: /Sources/Subs.php
Line: 238

2: Missing argument 3 for db_query(), called in /Sources/SPortal1-1.php(3244) : eval()'d code on line 9 and defined
File: /Sources/Subs.php
Line: 238


These errors are from this block only. :(
« Last Edit: May 10, 2009, 06:05:22 PM by techprince »

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: A Better "SMF ARTICLES" Block
« Reply #18 on: May 10, 2009, 06:09:40 PM »
Hum.. This is very odd :'( I don't know what's wrong with the block. In smf 2.0 block i'm not getting any error.

Can you attach your Subs.php? Maybe the problem is from it
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

techprince

  • Guest
Re: A Better "SMF ARTICLES" Block
« Reply #19 on: May 10, 2009, 06:28:47 PM »
Sorry for the delay, and this is for 1.1.8 :)

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: A Better "SMF ARTICLES" Block
« Reply #20 on: May 10, 2009, 11:15:55 PM »
Ok, I think I know what the problem is:

in line 238 of your Subs.php says:
Code: [Select]
function db_query($db_string, $file, $line)
Well, I'm a SMF 2.0 User not and 1.1.x so I didn't knew what was happening. I searched a bit and found that SMF 1.1.x needs arguments for $file and $line.

In other words, it needs this when we do a query:
Code: [Select]
__FILE__, __LINE__
eheh :P

So, try this in a php block and see if it works ;)
Code: [Select]
global $scripturl, $db_prefix;
isAllowedTo('view_articles');
$dbresult = db_query("
SELECT a.ID_ARTICLE, a.title, a.commenttotal
FROM {$db_prefix}articles AS a
WHERE a.approved = 1
ORDER BY a.date DESC
LIMIT 8", __FILE__, __LINE__);

echo'
<table>';
while ($row = mysql_fetch_assoc($dbresult))
{
echo '
<tr>
<td align="center" style="padding:6px;">', sp_embed_image('topic'), ' </td>
<td><span class="smalltext"><a href="' . $scripturl . '?action=articles;sa=view;article=' . $row['ID_ARTICLE'] . '">' . $row['title'] . '  (' . $row['commenttotal'] . ')</a></span></td>
</tr>';
}
mysql_free_result($dbresult);

echo'
</table>
<hr>
', sp_embed_image('dot'), ' <span class="smalltext"><font color="#000000"><b><a href="' . $scripturl . '?action=articles">Read ALL Reviews</a></b></span>';
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

techprince

  • Guest
Re: A Better "SMF ARTICLES" Block
« Reply #21 on: May 11, 2009, 01:58:23 PM »
Working fine :) and i also found out the same last day :)

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: A Better "SMF ARTICLES" Block
« Reply #22 on: May 11, 2009, 02:05:06 PM »
Glad I helped you :P
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

techprince

  • Guest
Re: A Better "SMF ARTICLES" Block
« Reply #23 on: May 11, 2009, 02:15:59 PM »
There is no Karma system enabled here or else i would have repped you :) Thanks for everything :D

And yes, here is the XHTML Transitional Valid Code for Latest Articles :)

Code: [Select]
global $scripturl, $db_prefix;
isAllowedTo('view_articles');
$dbresult = db_query("
SELECT a.ID_ARTICLE, a.title, a.commenttotal
FROM {$db_prefix}articles AS a
WHERE a.approved = 1
ORDER BY a.date DESC
LIMIT 8", __FILE__, __LINE__);

echo'
<table>';
while ($row = mysql_fetch_assoc($dbresult))
{
echo '
<tr>
<td style="text-align:center;padding:6px;">', sp_embed_image('topic'), ' </td>
<td><span class="smalltext"><a href="' . $scripturl . '?action=articles;sa=view;article=' . $row['ID_ARTICLE'] . '">' . $row['title'] . '  (' . $row['commenttotal'] . ')</a></span></td>
</tr>';
}
mysql_free_result($dbresult);

echo'
</table><hr />
', sp_embed_image('dot'), ' <span class="smalltext"><i><b><a href="' . $scripturl . '?action=articles">Read ALL Reviews</a></b></i></span>';
« Last Edit: May 11, 2009, 02:22:39 PM by techprince »

Offline Daydreamer

  • Jr. Member
  • **
  • Posts: 59
  • Gender: Male
  • ĐŻocKayseri
    • mnyk
  • SMF Version: 2 RC1
  • SP Version: 2.2
Re: A Better "SMF ARTICLES" Block
« Reply #24 on: June 02, 2009, 07:20:03 PM »
I used this style.. This code should work on 2.0.
Code: [Select]
function makale()
{
global $smcFunc, $scripturl;
isAllowedTo('view_articles');
$dbresult = $smcFunc['db_query']('', "
SELECT a.ID_ARTICLE, a.title, a.description, a.ID_CAT, imageurl
FROM {db_prefix}articles AS a
LEFT JOIN {db_prefix}articles_cat AS c ON (a.ID_CAT = c.ID_CAT)
WHERE a.approved = 1
ORDER BY a.date DESC
LIMIT 6
");
echo'<div class="clearfloat" id="article">';
while ($row = $smcFunc['db_fetch_assoc']($dbresult))
{
echo '
<div class="clearfloat" style="border-bottom:1px solid #111111;">
<a href="' . $scripturl . '?action=articles;sa=view;article=' . $row['ID_ARTICLE'] . '">
   <img src="' . $row['imageurl'] . '" alt="',$item['title'],'"  class="left" />
   </a>
   <div class="info"><a href="' . $scripturl . '?action=articles;sa=view;article=' . $row['ID_ARTICLE'] . '" class="title">',shorten_subject($row['title'], 50),'</a><br />
  <div class="meta" style="font-size:10px;">',shorten_subject($row['description'], 100), '</div>
</div></div>
';
}
echo'</div>';
$smcFunc['db_free_result']($dbresult);
}
makale();
This style code requires..
Code: [Select]
#article .info {
padding:5px 0;
width:190px;
}
#article .clearfloat {
margin-bottom:8px;
margin-top:7px;
display:block;
}
#article a img {
margin-right:10px;
margin-top:2px;
padding:5px 0;
}
.left, .alignleft {
float:left;
}
Seems like in attachment

Offline primetime

  • Semi Newbie
  • *
  • Posts: 8
  • SMF Version: 2 RC1
  • SP Version: 2.2.2
Re: A Better "SMF ARTICLES" Block
« Reply #25 on: August 04, 2009, 11:05:15 PM »
problem solved
« Last Edit: August 05, 2009, 11:43:30 AM by primetime »

Offline kcmartz

  • Semi Newbie
  • *
  • Posts: 39
  • SMF Version: 2.0.4
  • SP Version: 2.3.5
Re: A Better "SMF ARTICLES" Block
« Reply #26 on: April 18, 2010, 07:38:20 PM »
Does this work for SMF 2.0RC3?

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: A Better "SMF ARTICLES" Block
« Reply #27 on: April 19, 2010, 03:02:25 AM »
Does this work for SMF 2.0RC3?

Well, despite the fact that SMF Articles hasn't been updated yet. That block code works fine.
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline haito

  • Semi Newbie
  • *
  • Posts: 46
  • Gender: Male
  • maybe lucky
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A Better "SMF ARTICLES" Block
« Reply #28 on: July 14, 2010, 12:10:56 AM »
I used this style.. This code should work on 2.0.
Code: [Select]
function makale()
{
global $smcFunc, $scripturl;
isAllowedTo('view_articles');
$dbresult = $smcFunc['db_query']('', "
SELECT a.ID_ARTICLE, a.title, a.description, a.ID_CAT, imageurl
FROM {db_prefix}articles AS a
LEFT JOIN {db_prefix}articles_cat AS c ON (a.ID_CAT = c.ID_CAT)
WHERE a.approved = 1
ORDER BY a.date DESC
LIMIT 6
");
echo'<div class="clearfloat" id="article">';
while ($row = $smcFunc['db_fetch_assoc']($dbresult))
{
echo '
<div class="clearfloat" style="border-bottom:1px solid #111111;">
<a href="' . $scripturl . '?action=articles;sa=view;article=' . $row['ID_ARTICLE'] . '">
   <img src="' . $row['imageurl'] . '" alt="',$item['title'],'"  class="left" />
   </a>
   <div class="info"><a href="' . $scripturl . '?action=articles;sa=view;article=' . $row['ID_ARTICLE'] . '" class="title">',shorten_subject($row['title'], 50),'</a><br />
  <div class="meta" style="font-size:10px;">',shorten_subject($row['description'], 100), '</div>
</div></div>
';
}
echo'</div>';
$smcFunc['db_free_result']($dbresult);
}
makale();
This style code requires..
Code: [Select]
#article .info {
padding:5px 0;
width:190px;
}
#article .clearfloat {
margin-bottom:8px;
margin-top:7px;
display:block;
}
#article a img {
margin-right:10px;
margin-top:2px;
padding:5px 0;
}
.left, .alignleft {
float:left;
}
Seems like in attachment
it doesnt work anymore :'(
update please
- brrr

Offline haito

  • Semi Newbie
  • *
  • Posts: 46
  • Gender: Male
  • maybe lucky
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A Better "SMF ARTICLES" Block
« Reply #29 on: July 17, 2010, 12:06:07 AM »
anyone? :(
- brrr

Offline haito

  • Semi Newbie
  • *
  • Posts: 46
  • Gender: Male
  • maybe lucky
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A Better "SMF ARTICLES" Block
« Reply #30 on: August 01, 2010, 05:41:06 AM »
bump. update please  :(
- brrr

Offline excaliburj

  • Semi Newbie
  • *
  • Posts: 18
Re: A Better "SMF ARTICLES" Block
« Reply #31 on: August 02, 2010, 01:42:06 PM »
Not sure about the styling, but this code should pull up the article info:

Code: [Select]
global $smcFunc, $scripturl;
isAllowedTo('view_articles');
$dbresult = $smcFunc['db_query']('', "
SELECT a.ID_ARTICLE, a.title, a.description, a.ID_CAT, imageurl
FROM {db_prefix}articles AS a
LEFT JOIN {db_prefix}articles_cat AS c ON (a.ID_CAT = c.ID_CAT)
WHERE a.approved = 1
ORDER BY a.date DESC
LIMIT 6", array());

echo'<div class="clearfloat" id="article">';
while ($row = $smcFunc['db_fetch_assoc']($dbresult))
{
echo '
<div class="clearfloat" style="border-bottom:1px solid #111111;">
<a href="' . $scripturl . '?action=articles;sa=view;article=' . $row['ID_ARTICLE'] . '">
   <img src="' . $row['imageurl'] . '" alt="',$item['title'],'"  class="left" />
   </a>
   <div class="info"><a href="' . $scripturl . '?action=articles;sa=view;article=' . $row['ID_ARTICLE'] . '" class="title">',shorten_subject($row['title'], 50),'</a><br />
  <div class="meta" style="font-size:10px;">',shorten_subject($row['description'], 100), '</div>
      </div></div>
';
}
echo'</div>';
$smcFunc['db_free_result']($dbresult);

Offline Morph

  • Semi Newbie
  • *
  • Posts: 14
  • Gender: Male
  • AngelinaBelle Fan!
    • NKGCommunity
  • SMF Version: 1.1.12
  • SP Version: 2.3.3
Re: A Better "SMF ARTICLES" Block
« Reply #32 on: November 19, 2010, 06:37:39 AM »
i'm sorry for the question, i don't understand well, maybe the language.
Where can i put that code? i try to add a php block with this code on my sp 2.3.1, but i obtain this error:

Code: [Select]
Table 'Sql215428_4.smf_articles' doesn't exist
File: /web/htdocs/www.nkgcommunity.it/home/forumb/Sources/PortalBlocks.php(3461) : eval()'d code
Linea: 8

I naturally use simple portal articles...

Many thanks

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A Better "SMF ARTICLES" Block
« Reply #33 on: November 19, 2010, 08:20:06 AM »
This block is intended to work with the SMF ARTICLES mod.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline Morph

  • Semi Newbie
  • *
  • Posts: 14
  • Gender: Male
  • AngelinaBelle Fan!
    • NKGCommunity
  • SMF Version: 1.1.12
  • SP Version: 2.3.3
Re: A Better "SMF ARTICLES" Block
« Reply #34 on: November 19, 2010, 09:45:30 AM »
oh, so, i have to install this mod:
http://custom.simplemachines.org/mods/index.php?mod=1354
and then i must add a php block with the code that i can find in this topic.
Is it correct?
Thank you again!

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A Better "SMF ARTICLES" Block
« Reply #35 on: November 19, 2010, 11:05:40 AM »
I think that is the general idea.
 
It is also possible to simply use the SimplePortal articles system, and use a SimplePortal articles block.  Please give it a try and see if it does what you need it to do.  I think the idea of SMF ARTICLES is a bit more akin to SimplePortal pages. But not exactly.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline fdr77

  • Jr. Member
  • **
  • Posts: 60
  • Gender: Male
  • Non può piovere per sempre
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: A Better "SMF ARTICLES" Block
« Reply #36 on: December 10, 2010, 09:09:19 PM »
in which file,  enter the code css?
E' meglio bruciarsi in fretta che spegnersi lentamente                                               Kurt D. Cobain

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A Better "SMF ARTICLES" Block
« Reply #37 on: December 12, 2010, 10:50:14 PM »
portal.css might be a good place to add CSS for blocks.
This block works with SMF ARTICLES mod.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline barbar

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: A Better "SMF ARTICLES" Block
« Reply #38 on: January 17, 2011, 05:09:17 PM »
how can i set the limit for number of characters per article and also display the embeded video? i dont use my forums so i cant use simple articles

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A Better "SMF ARTICLES" Block
« Reply #39 on: January 17, 2011, 05:16:28 PM »
Articles are just certain designated topic posts from your forum.
You can use the [cutoff] tag instead of character limit.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline barbar

  • Semi Newbie
  • *
  • Posts: 22
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: A Better "SMF ARTICLES" Block
« Reply #40 on: January 18, 2011, 02:29:44 AM »
no i mean i use vb gamer articles and i want more than just a title, and expose according to how many words

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A Better "SMF ARTICLES" Block
« Reply #41 on: January 18, 2011, 08:55:54 AM »
Sorry.  I slipped a gear there.
You should start by checking the options SMF ARTICLES provides for truncating articles.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline lgice

  • Newbie
  • Posts: 2
  • SMF Version: None
  • SP Version: None
Re: A Better "SMF ARTICLES" Block
« Reply #42 on: March 15, 2011, 07:31:13 PM »
I was wondering if it was possible to add something like this for the SMF article system, where you have the latest articles in a list on the right and a slideshow of them from top to bottom and then it showing maybe a background image and a small bit of the article in the larger space. any help by any chance or is this even possible?



Uploaded with ImageShack.us

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A Better "SMF ARTICLES" Block
« Reply #43 on: March 15, 2011, 09:05:23 PM »
This is most likely possible.
You would have to go through the code for SMF ARTICLES, find the bits you want, and pop them into a php block.


Sounds like quite a bit of custom coding.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline lgice

  • Newbie
  • Posts: 2
  • SMF Version: None
  • SP Version: None
Re: A Better "SMF ARTICLES" Block
« Reply #44 on: March 25, 2011, 05:13:30 PM »
could anyone tell me what part of the code actually displays the 5 articles im trying to write something for a block here is what i have

Code: [Select]
<center>
<table
 style="text-align: left; width: 800px; height: 280px;"
 border="1" cellpadding="2" cellspacing="2">
  <tbody>
    <tr>
      <td style="width: 558px;">
<marquee direction="left" scrolldelay="120">
<a href="http://www.realgamers.org/index.php?action=articles;sa=view;article=1">
<img src="http://i56.tinypic.com/21kk02g.jpg" width="380" height="280"></a>

<a href="http://www.realgamers.org/index.php?action=articles;sa=view;article=1">
<img src="http://i52.tinypic.com/23j07z9.jpg" width="380" height="280"></a>

<a href="http://www.realgamers.org/index.php?action=articles;sa=view;article=1">
<img src="http://i53.tinypic.com/1zc2v04.gif" width="380" height="280"></a>
</marquee></td>
      <td style="width: 222px;">Latest Article List Will Go Here

I WANT THE LIST OF 5 OR MORE ARTICLES TO GO HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

</td>
    </tr>
  </tbody>
</table>
</center>





', sp_embed_image('dot'), ' <span class="smalltext"><font color="#CCCCCC"><b><a href="' . $scripturl . '?action=articles">Read ALL Articles</a></b></span>';


Offline donidion

  • Newbie
  • Posts: 2
  • SMF Version: None
  • SP Version: None
Re: [BLOCK] A Better "SMF ARTICLES" Block
« Reply #45 on: April 08, 2011, 06:35:25 AM »

Offline robotron

  • Semi Newbie
  • *
  • Posts: 19
  • SMF Version: 1.1.12
  • SP Version: 2.3.3
Re: A Better "SMF ARTICLES" Block
« Reply #46 on: June 03, 2011, 11:25:08 PM »
how I can implement the code in smf 1.1.13?

I have this error when testing the code:

Note: It appears that your database may require an upgrade. The version of your forum files are in SMF version 1.1.13, while your database is in the version of SMF 1.1.12. I suggest running the latest version of upgrade.php.





Offline EvilGeneral

  • Semi Newbie
  • *
  • Posts: 13
  • Gender: Male
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: A Better "SMF ARTICLES" Block
« Reply #47 on: August 19, 2011, 02:11:42 PM »
Look: @@

Quote
Table 'mydatabase.smf1_articles' doesn't exist
Arquivo: /home/myfolder/public_html/Sources/PortalBlocks.php(3351) : eval()'d code
Linha: 9

 :o

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A Better "SMF ARTICLES" Block
« Reply #48 on: August 22, 2011, 08:37:21 AM »
You must have the smf articles mod installed for this to work.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?