News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

custom action mod - eval error

Started by digit, November 18, 2009, 03:02:36 AM

Previous topic - Next topic

digit

'was waiting for a response...  and didn't see this one! Thanks for responding...

Well, I'd like to display some recent posts, from certain boards, showing some avatars and attachments!  8)
Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members


SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)

Arantor

As a *minimum* you need to tell me:
* which boards
* whether the avatars are on the left or right of the post
* whether attachments should be just a list of links, showing image thumbnails or showing the full pictures from attachments.

digit

Quote from: Arantor on November 19, 2009, 10:31:47 AM
As a *minimum* you need to tell me:
* which boards
* whether the avatars are on the left or right of the post
* whether attachments should be just a list of links, showing image thumbnails or showing the full pictures from attachments.

Boards:  287, 288, 289, 290
Avatars on right
Attachments as thumbnails. (however - I am using a now non existent attachments location mod, so I am not sure that's going to work!)

I think (or pray!)  if I can just see how you construct the array (and custom action) I can fly from there!

Thanks!
Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members


SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)

Arantor


$parameters = array(
  'board' => array(287, 288, 289, 290),
  'avatar' => SSI_AVATAR_RIGHT,
  'attachments' => SSI_ATTACH_THUMBNAIL,
);
ssi_multiBoardNews($parameters);

digit

VERY VERY cool - however, I am seeing no avatars, and no attachments - I am assuming because of that attachments location mod - can I pm you the URL?

Thanks!
Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members


SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)

digit

Hmm, also getting a ton of errors - here's my problem, but I don't know how to fix it....


8: Use of undefined constant SSI_AVATAR_NONE - assumed 'SSI_AVATAR_NONE'
File: /SSI.php
Line: 3750


8: Use of undefined constant SSI_AVATAR_NONE - assumed 'SSI_AVATAR_NONE'
File: /SSI.php
Line: 3750


8: Use of undefined constant SSI_AVATAR_NONE - assumed 'SSI_AVATAR_NONE'
File: /SSI.php
Line: 3750


8: Use of undefined constant SSI_AVATAR_NONE - assumed 'SSI_AVATAR_NONE'
File: /SSI.php
Line: 3750


8: Use of undefined constant SSI_AVATAR_NONE - assumed 'SSI_AVATAR_NONE'
File: /SSI.php
Line: 3750


8: Use of undefined constant SSI_FEED_ATOM - assumed 'SSI_FEED_ATOM'
File: /SSI.php
Line: 3739


8: Use of undefined constant SSI_FEED_RDF - assumed 'SSI_FEED_RDF'
File: /SSI.php
Line: 3733


8: Use of undefined constant SSI_FEED_RSS - assumed 'SSI_FEED_RSS'
File: /SSI.php
Line: 3727


8: Use of undefined constant SSI_AVATAR_NONE - assumed 'SSI_AVATAR_NONE'
File: /SSI.php
Line: 3692


8: Use of undefined constant SSI_ATTACH_NONE - assumed 'SSI_ATTACH_NONE'
File: /SSI.php
Line: 3646


8: Use of undefined constant SSI_FEED_NONE - assumed 'SSI_FEED_NONE'
File: /SSI.php
Line: 3459


8: Use of undefined constant SSI_ATTACH_THUMBNAIL - assumed 'SSI_ATTACH_THUMBNAIL'
File: /Themes/default/CustomAction.template.php (main sub template - eval?)
Line: 20


8: Use of undefined constant SSI_AVATAR_LEFT - assumed 'SSI_AVATAR_LEFT'
File: /Themes/default/CustomAction.template.php (main sub template - eval?)
Line: 19


I DO have this in my SSI.php....

// Don't do anything if SMF is already loaded.
if (defined('SMF'))
   return true;

define('SMF', 'SSI');
// Constants for ssi_multiBoardNews
if(!defined('SSI_ATTACH_NONE')) {
   define('SSI_ATTACH_NONE', 0);
   define('SSI_ATTACH_LINKONLY', 1);
   define('SSI_ATTACH_THUMBNAIL', 2);
   define('SSI_ATTACH_INLINE', 3);
   define('SSI_AVATAR_NONE', 0);
   define('SSI_AVATAR_LEFT', 1);
   define('SSI_AVATAR_RIGHT', 2);
   define('SSI_FEED_NONE', 0);
   define('SSI_FEED_RSS', 1);
   define('SSI_FEED_ATOM', 2);
   define('SSI_FEED_RDF', 4);
}
Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members


SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)

Arantor

Ahhh, I know why you're getting the errors. You're getting those because you're including SSI.php from inside SMF itself.

Move the second block you point out above the first.

digit

Like this?

// Constants for ssi_multiBoardNews
if(!defined('SSI_ATTACH_NONE')) {
   define('SSI_ATTACH_NONE', 0);
   define('SSI_ATTACH_LINKONLY', 1);
   define('SSI_ATTACH_THUMBNAIL', 2);
   define('SSI_ATTACH_INLINE', 3);
   define('SSI_AVATAR_NONE', 0);
   define('SSI_AVATAR_LEFT', 1);
   define('SSI_AVATAR_RIGHT', 2);
   define('SSI_FEED_NONE', 0);
   define('SSI_FEED_RSS', 1);
   define('SSI_FEED_ATOM', 2);
   define('SSI_FEED_RDF', 4);
}


define('SMF', 'SSI');


I am still getting the errors.
Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members


SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)

Arantor

Huh? The errors are caused by the constants not being defined, and with that they should be being defined :-/

digit

#29
Yep, I was still getting the errors...

However, I just tried adding this...

// Constants for ssi_multiBoardNews
if(!defined('SSI_ATTACH_NONE')) {
   define('SSI_ATTACH_NONE', 0);
   define('SSI_ATTACH_LINKONLY', 1);
   define('SSI_ATTACH_THUMBNAIL', 2);
   define('SSI_ATTACH_INLINE', 3);
   define('SSI_AVATAR_NONE', 0);
   define('SSI_AVATAR_LEFT', 1);
   define('SSI_AVATAR_RIGHT', 2);
   define('SSI_FEED_NONE', 0);
   define('SSI_FEED_RSS', 1);
   define('SSI_FEED_ATOM', 2);
   define('SSI_FEED_RDF', 4);
}


To the custom php action, and voila! My attachments are working, and my avatars are ALMOST working LOL...

But it is showing avatar URL's like this (getting a broken icon)

http://www.mysite.com/index.php?action=dlattach;attach=379267;type=avatar

When my avatar urls look like....

http://www.mysite.com/avataruploads/avatar_35220.png

I am also now getting a bunch of other errors like these...

8: Undefined index: id_thumb
File: /users/SSI.php
Line: 3683

8: Undefined index: kilobyte
File: /users/SSI.php
Line: 3677

Here is what I did with the custom action....

require("/users/SSI.php");

echo '
<center>
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">
<tr>
<td class="catbg" align="center">
RECENT POSTS</td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="10" class="maintable">
<tr>
<td bgcolor="#FFFFFF"><br />
<blockquote>';


// Constants for ssi_multiBoardNews
if(!defined('SSI_ATTACH_NONE')) {
define('SSI_ATTACH_NONE', 0);
define('SSI_ATTACH_LINKONLY', 1);
define('SSI_ATTACH_THUMBNAIL', 2);
define('SSI_ATTACH_INLINE', 3);
define('SSI_AVATAR_NONE', 0);
define('SSI_AVATAR_LEFT', 1);
define('SSI_AVATAR_RIGHT', 2);
define('SSI_FEED_NONE', 0);
define('SSI_FEED_RSS', 1);
define('SSI_FEED_ATOM', 2);
define('SSI_FEED_RDF', 4);
}

$parameters = array(
  'board' => array(35,9),
  'avatar' => SSI_AVATAR_LEFT,
  'attachments' => SSI_ATTACH_INLINE,
);
ssi_multiBoardNews($parameters);
echo '
</blockquote>

</td>
</tr>
</table>';






Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members


SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)

Arantor

Well, the kilobyte index is something I assumed naively would be in 1.1 the same as it is in 2.0 - but isn't. You'll find $txt['kilobyte'] in SSI.php, which should be replaced with $txt['smf211'].

The id_thumb issues are caused by:
$attachment['thumbnail'] = $attach_single['id_thumb'] == 0 ? false : array(
'href' => $scripturl . '?action=dlattach;topic=' . $attach_single['ID_TOPIC'] . '.0;attach=' . $attach_single['id_thumb'] . ';image',


Which should be:
$attachment['thumbnail'] = $attach_single['ID_THUMB'] == 0 ? false : array(
'href' => $scripturl . '?action=dlattach;topic=' . $attach_single['ID_TOPIC'] . '.0;attach=' . $attach_single['ID_THUMB'] . ';image',



As for the other error, curious. I completely forgot to test for users who use custom avatar directories.

* Arantor goes back to figure out how to make that work.

digit

#31
Thanks - but I'm still getting broken icons for the avatars.  :P  (but ALL the errors went away - YAY!)

Also,  is there a way within the array to define how many posts to display?

Thanks for the help, this is going to be VERY useful and cool once I (or we) work the kinks out.
Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members


SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)

Arantor

You will do until I figure out why it's not working. Though it 'should' since it does actually do a check against the relevant paths, I just never tested that since I got the code directly from Display.php.


You can set how many threads it examines with $parameters['limit'] but it will only ever retrieve the first post from each topic, just like ssi_boardNews does.

digit

BTW - I am also looking forward to your OpenSearch integration...  I tried Sphynx, but found the results wonky.
Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members


SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)

Arantor

OpenSearch isn't a search backend.

It's a hook to your browser and other systems how they can search your forum.

digit

Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members


SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)

Arantor

* Arantor is confused why everyone calls it Sphynx when it's spelt Sphinx based on it being short for SQL phrase index.

If you're getting funny results from Sphinx, means something isn't configured right, usually.

digit

Sphinx...   8)

BTW - I just tried your ssi_multiBoardNews with other boards (and a limit of 100)... and noticed that it IS displaying avatars that are server stored and selected, but not uploaded avatars.

Happily using a heavily modified 1.1.16 version of SMF!

2748011 Posts in 320998 Topics by 50986 Members


SOLD my website - thanks it was a good run - they converted to vbadvanced. (and screwed it up good!)

Arantor

Ah so it's just related to uploaded avatars where there's a custom avatar directory.

Thanks, I think I know where to look now...

Advertisement: