TinyPortal

Development => Support => Topic started by: davieb on April 11, 2009, 04:22:54 PM

Title: Need urgent help with a side block
Post by: davieb on April 11, 2009, 04:22:54 PM
I've added a side block today to my site www.enjoyingphotography.co.uk and it is showing an error

Quotefatal error: Function name must be a string in /home/davidbre/public_html/enjoyingphotography/forum/Sources/Load.php(1749) : eval()'d code(52) : eval()'d code on line 3

Only the sidebar shows now. The rest of the site doesn't appear. I also can't get into the admin panel to switch the block off.

I'm running SMF1.1.8 and TP 1.06
Title: Re: Need urgent help with a side block
Post by: davieb on April 11, 2009, 04:34:08 PM
Forgot to mention the block only appears to admins. It doesn't show to anyone else as it's set for admins only while I was testing it.
Title: Re: Need urgent help with a side block
Post by: ZarPrime on April 11, 2009, 04:35:01 PM
davieb,

I just looked at your site and I don't see a problem with it.  Have you solved this yourself?  If so, how did you do it?

ZarPrime
Title: Re: Need urgent help with a side block
Post by: ZarPrime on April 11, 2009, 04:36:06 PM
OK, so, you still can't get into Admin to turn the block off.  What is the code you are using in the block?

ZarPrime

Edit:  David, if it's just that the errant clock is keeping you from getting into Admin, this link should let you get in there ---> http://enjoyingphotography.davidbrennan.co.uk/forum/index.php/index.php?action=admin;noblocks

Title: Re: Need urgent help with a side block
Post by: Renegd98 on April 11, 2009, 04:39:52 PM
http://www.enjoyingphotography.co.uk/index.php?action=admin  will take you directly to the admin panel so you can turn it off.
Title: Re: Need urgent help with a side block
Post by: davieb on April 11, 2009, 04:45:12 PM
Quote from: ZarPrime on April 11, 2009, 04:36:06 PM
OK, so, you still can't get into Admin to turn the block off.  What is the code you are using in the block?

ZarPrime

the code is
global $smcFunc, $scripturl;
isAllowedTo('view_articles');
$dbresult = $smcFunc['db_query']('', "
SELECT a.ID_ARTICLE, a.title, a.views
FROM {db_prefix}articles AS a
ORDER BY RAND()
LIMIT 3
");

while ($row = $smcFunc['db_fetch_assoc']($dbresult))
{
echo ' ', sp_embed_image('dot'), ' <a href="' . $scripturl . '?action=articles;sa=view;article=' . $row['ID_ARTICLE'] . '">' . $row['title'] . '</a> (' . $row['views'] . ' views)<br />';
}
$smcFunc['db_free_result']($dbresult);


I was trying to create something to show the latest articles from SMF Articles
Title: Re: Need urgent help with a side block
Post by: davieb on April 11, 2009, 04:47:56 PM
Quote from: ZarPrime on April 11, 2009, 04:36:06 PM
OK, so, you still can't get into Admin to turn the block off.  What is the code you are using in the block?

ZarPrime

Edit:  David, if it's just that the errant clock is keeping you from getting into Admin, this link should let you get in there ---> http://enjoyingphotography.davidbrennan.co.uk/forum/index.php/index.php?action=admin;noblocks

Sorry didn't spot the edit. That lets me in to the admin but as soon as I click Panels and blocks I hit the same problem as the block shows on all pages I think.
All I see is the attached screen
Title: Re: Need urgent help with a side block
Post by: ZarPrime on April 11, 2009, 04:56:23 PM
OK, a coder will have to tell you what's the matter with that actual code.

However, for now, try this link instead.  This should take you straight to the blocks and panels ...
http://enjoyingphotography.davidbrennan.co.uk/forum/index.php/action,tpadmin/sa,blocks.html?noblocks

If that doesn't work, let me know as that is what I would have to do on my site to get to that point.  However, I have SEO turned on so that may not work in your site.  If it doesn't work, LMK and I'll give you another link to try.

ZP
Title: Re: Need urgent help with a side block
Post by: davieb on April 11, 2009, 05:00:34 PM
Hi ZarPrime and thanks. That did the trick. Once I was able to see the panel and blocks page without the blocks showing it was just a case of binning the block. As to what's wrong with the code, no idea but I won't be using it again lol

I think I'll make a note of those 2 urls as well. Very handy in case of any other errors I make
Title: Re: Need urgent help with a side block
Post by: ZarPrime on April 11, 2009, 05:15:16 PM
OK, I'm glad that got you to where you needed to be. :up:

Out of curiosity, what was the code supposed to do?  One thing you might want to keep in mind for future reference is that php prefers that you use all lower case letters, at least I think so, but I don't know if that has anything to do with it.  Like I said, one of our coders more knowledgeable in php would have to tell you.

On those, links, yes they have saved me a time or 2 as well. ;)

ZarPrime
Title: Re: Need urgent help with a side block
Post by: davieb on April 11, 2009, 05:41:05 PM
Quote from: ZarPrime on April 11, 2009, 05:15:16 PM
Out of curiosity, what was the code supposed to do?  One thing you might want to keep in mind for future reference is that php prefers that you use all lower case letters, at least I think so, but I don't know if that has anything to do with it.  Like I said, one of our coders more knowledgeable in php would have to tell you.

The idea was to use a block to pull the titles of the most recent additions in SMF Articles. It's based around a block snippet I found elsewhere and thought it may work with TP but it didn't.
Title: Re: Need urgent help with a side block
Post by: IchBin on April 12, 2009, 03:14:51 AM
That code would only work with SMF2.
Title: Re: Need urgent help with a side block
Post by: davieb on April 12, 2009, 07:24:27 AM
Had a feeling that may be the case but thought I'd try it anyway.