TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,970
  • Latest: bynw
Stats
  • Total Posts: 196,058
  • Total Topics: 21,338
  • Online today: 234
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 134
  • Total: 135
  • lurkalot

Error in Block for Recent Articles

Started by wildenborch, July 23, 2011, 08:16:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wildenborch

Hi All,

I search this forum for a good working recent article block but without success.
Can someone help with this?

The one included in TP (Articles: recently written) is not working for me.
If I enable this block it show me my site in this block.
See attachment

Best regards,
Wildenborch

iceman11a

#1
Link to my site: http://www.df-barracks.com/index.php
SMF version: SMF ver. 2.0 RC5
TP version: TP ver. 1.104 I just updated it to the newer version
Default Forum Language: English
Theme name and version: Default
Browser Name and Version: Firefox and IE
Mods installed:

1.    SMFShop    3.1.6.1    [ Uninstall ] [ List Files ] [ Delete ]
2.    SMF Arcade    2.5 RC1    [ List Files ] [ Delete ]
3.    Simple Audio Video Embedder    1.1    [ Uninstall ] [ List Files ] [ Delete ]
4.    Topic Solved    1.1.1    [ Uninstall ] [ List Files ] [ Delete ]
5.    Enhanced About Page (0.01)    0.01    [ Uninstall ] [ List Files ] [ Delete ]
6.    SMFBlog    1.0    [ Install Mod ] [ List Files ] [ Delete ]
7.    Page Management    1.4    [ Uninstall ] [ List Files ] [ Delete ]
8.    Post Ratings    1.5    [ List Files ] [ Delete ]
9.    Buddy List Page    1.0    [ Uninstall ] [ List Files ] [ Delete ]
10.    Lifetime Subscriptions    1.0    [ Uninstall ] [ List Files ] [ Delete ]
11.    Custom Form Mod    1.6    [ Uninstall ] [ List Files ] [ Delete ]
12.    AjaxChat Integration    3.2.1 (modified for SMF 2 RC3)    [ Uninstall ] [ List Files ] [ Delete ]
13.    TinyPortal    1.104    [ Uninstall ] [ List Files ] [ Delete ]
14.    SMF Gallery Lite    3.0.3    [ Uninstall ] [ List Files ] [ Delete ]
15.    Country Flags    1.1.2    [ Uninstall ] [ List Files ] [ Delete ]
16.    Contact Page    2.1.1    [ Uninstall ] [ List Files ] [ Delete ]

Related Error messages:
Recent Artitcles
An Error Has Occurred!
Invalid value inserted or no type specified.

This error shows in the block for resent articles. and I tried deleted and articles and adding a new one and it doesn't seem to work. So any one have any ideas on what to do.


ZarPrime

Hmmm, interesting that you both found the same error within a couple of hours of each other.  Obviously, there is a bug in that block.

Wildenborch, are you using SMF 2.0 and the latest TP as well?  If you still want to request "a good working recent article block" rather than waiting for us to find and fix the bug, please post your request to the Requests Board --> http://www.tinyportal.net/index.php?board=133.0

Added to Bugtracker --> http://www.tinyportal.net/index.php?issue=99.0

ZarPrime

iceman11a

So I take it there's no way to fix this. Wow that sucks. any ideas on when the fix will be released and I guess that's a hard answer to answer


wildenborch

Yes, I have SMF version 2.0 and the laterst TP version (1.104) and SMFGallery (3.0.25) installed.

I will post my request in the Requests Board (although I believe that my first posting was done in that board).

IchBin

Wow, I'm laughing at myself on this one. Those are some pretty ugly errors. I have no idea why I would have added {now} thinking it was going to work...

Find this section in Sources/TPSubs.php

$request = $smcFunc['db_query']('', '
SELECT art.id, art.date, art.subject, art.views, art.rating, art.comments
FROM {db_prefix}tp_articles as art
WHERE art.off = {int:off} and art.approved = {int:approved}
AND ((art.pub_start = 0 AND art.pub_end = 0)
OR (art.pub_start != 0 AND art.pub_start < {now} AND art.pub_end = 0)
OR (art.pub_start = 0 AND art.pub_end != 0 AND art.pub_end > {now})
OR (art.pub_start != 0 AND art.pub_end != 0 AND art.pub_end > {now} AND art.pub_start < {now}))
ORDER BY {string:orderby} DESC LIMIT {int:limit}',
array(
'off' => 0, 'approved' => 1, 'orderby' => $orderby, 'limit' => $max,
)
);


Replace with this code:
$request = $smcFunc['db_query']('', '
SELECT art.id, art.date, art.subject, art.views, art.rating, art.comments
FROM {db_prefix}tp_articles as art
WHERE art.off = {int:off} and art.approved = {int:approved}
AND ((art.pub_start = 0 AND art.pub_end = 0)
OR (art.pub_start != 0 AND art.pub_start < '.$now.' AND art.pub_end = 0)
OR (art.pub_start = 0 AND art.pub_end != 0 AND art.pub_end > '.$now.')
OR (art.pub_start != 0 AND art.pub_end != 0 AND art.pub_end > '.$now.' AND art.pub_start < '.$now.'))
ORDER BY {raw:orderby} DESC LIMIT {int:limit}',
array(
'off' => 0, 'approved' => 1, 'orderby' => $orderby, 'limit' => $max,
)
);

iceman11a


wildenborch

Yes super!

One thing, the limit' => $max, setting does not seem to work properly. I changed the setting in line 2714
function art_recentitems($max = 5, $type = 'date' )  to 10 but only 5 articles are shown.
I had to change line 2739 and changed $max, in to 10,

That worked for me.



IchBin

Yeah it doesn't have effect unless you change the number where the art_recentitems() function is called. Looks like Bloc had the intention of giving the option to set the number in the settings for the block. Just didn't get to it. :)

ZarPrime

Quote from: wildenborch on July 24, 2011, 05:22:47 AM
Yes, I have SMF version 2.0 and the laterst TP version (1.104) and SMFGallery (3.0.25) installed.

I will post my request in the Requests Board (although I believe that my first posting was done in that board).

wildenborch,

Actually, no you didn't originally post your topic in the request board.  That's why I merged your topic with bigjoe's, since they were for the same issue.  I don't really remember what board you did first post to but it definitely wasn't the request board. ;)

ZarPrime

This website is proudly hosted on Crocweb Cloud Website Hosting.