Jump to content

How to use {{$item = \IPS\forums\Topic::load( $idTopic );}} in Pages

Featured Replies

Posted

Hi,

I have a Database with custom templates and I used to use "{{$item = \IPS\forums\Topic::load( $idTopic );}}" in order to get one topic's data.

Now, when I try to load this into $item, the template is not loaded and seems to fail.

How are we supposed to use this methods?

Cheers,

Ibai

Solved by Adriano Faria

Go to solution
  • Community Expert
  • Solution

it isn’t finding the topic probably. You should use try/catch to get a proper error message or skip in case of an error.

  • Author
 

it isn’t finding the topic probably. You should use try/catch to get a proper error message or skip in case of an error.

Humm... as I restored a backup and tried to make some space, this could be the reason... So as you say, it should load the data.

How can I use try/catch in this kind of template bits?

Thanks Adriano!

  • Community Expert
 

How can I use try/catch in this kind of template bits?

See an example with the variable $license here:

  • Author
 

See an example with the variable $license here:

Oh wow, I didn't even thought of doing that super easy way! Thanks! :)

Recently Browsing 0

  • No registered users viewing this page.