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

Recent

Welcome to TinyPortal. Please login or sign up.

September 16, 2024, 07:40:14 PM

Login with username, password and session length
Members
  • Total Members: 3,905
  • Latest: acciply
Stats
  • Total Posts: 195,368
  • Total Topics: 21,241
  • Online today: 342
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online

[TP 1.05] php article seems to be broken in TP

Started by BlueSteel, April 02, 2010, 08:34:03 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Blue Steel

I edited a php article to adjust settings and now the article wont display it comes up with an error

Quote
Parse error: syntax error, unexpected T_ECHO in /home/gamersl2/public_html/codingmonkeys.com/Sources/TPSubs.php(1730) : eval()'d code on line 15

so i tried it with a default settings new php article (+PHP)
and even with an empty content field it still come up with that error

PS: my original article was working after upgrade to TP 1.05 .. but stoped working when i went in to change the settings and hit save

on further review the preview function only works when i hit save .. and that worked fine on an empty +php article

here is my code i'm using in my article and as i say it was working fine untill i edited the settings


// "Recent Topics" a php Block
// Prefered settings when being designed
// Border and title on
// Title ="Recent Topics"

global $context, $settings, $options, $scripturl, $txt, $modSettings, $sourcedir;

$what=ssi_recentTopics('40', NULL, 'array');

echo '<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">';
echo '<tr class="catbg3"><td valign="middle">Subject</td><td valign="middle">Board</td><td valign="middle">Poster</td><td valign="middle">Time</td></tr>';

foreach ($what as $topic)
  {
    echo '<tr><td class="windowbg" valign="middle">';
      echo '<a href="', $topic['href'], '">', $topic['subject'],' </a>', $topic['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $topic['topic'] . '.msg' . $topic['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>';
      echo '</td><td class="windowbg2" valign="middle" >', $topic['board']['link'], '</td>';
      echo '</td><td class="windowbg2" valign="middle" >', $topic['poster']['link'], '</td><td class="windowbg2" valign="middle" >';
      if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] . '/images/icons/last_post.gif'))
      echo '<a href="', $topic['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';
      echo '<span class="smalltext">', $topic['time'], '</span></td></tr>';
  }

echo '</table>';


ok after a little trial and error it doesn'rt seem to like the echo commands inside the { } I've tried it with other code as well ..

the thing thats confusing me is that it was working prior to editing and changing settings on the block..

this error is also happening on new blocks to .. so i think that the editor is doing something when saving it or trying to parse in the php code

Hope this helps for a quick fix

Just tried this same code as a block and it works (all be it in the wrong colours as the Colour references have changed) .. i want to get it working in an article thats displaying the catlist (see that problem in another post.. not displaying catlist.. I was trying to get it working displaying the catlist .. like i had it in 1.04 .. thats when i ran into this bug)


IchBin

Yeah, looks like we have quite a few bugs related to saving articles.

Xarcell


Blue Steel

 SMF2 RC3 .. as it clearly states in my signature

bloc

This is a side-effect of preventing a specific issue with PHP in articles for SMF 2.0 versions - but I will revert this, as it creates more trouble than not it seems. Also see http://www.tinyportal.net/index.php?topic=32242.0 for same error. An update will be up soon.

Blue Steel

Thanks Bloc. anxiously waiting for the update