1
Wayde
Custom Blocks - Maybe a hard one
  • 2005/9/1 11:59

  • Wayde

  • Just popping in

  • Posts: 58

  • Since: 2004/9/14


Now...
iv searched the forums.. and i know its been asked before..
but surly its got to be possible...
using modules smarty tags, within a custom block..
does any one now how?

i tryed doing this in a custom php block to see if it would work.. but no luck.. any other ideas?

Quote:
include 'http://www.disciples.co.nz/modules/spotlight/blocks/kuht_head_news.php';

echo ' <{if $block.storyid != "0"}>

<{$block.newstitle}>


<{else}>
<{$block.newstitle}>
<{/if}>';


Thanks guys...
Lovin XOOPS :)

Take care

Wayde

2
mboyden
Re: Custom Blocks - Maybe a hard one
  • 2005/9/1 16:09

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


Instead, you'd need to use $xoopsTpl=>getVar(xoops_url) (or whichever SmartyVar you're trying to use) to use it in the block code. Also, you can assign a template for a block and then use smarty variables in that to display the block.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

3
Wayde
Re: Custom Blocks - Maybe a hard one
  • 2005/9/1 20:46

  • Wayde

  • Just popping in

  • Posts: 58

  • Since: 2004/9/14


Hey,
First off,, thanks for a speedy reply...
second.. forgive me for my slowness lol...
Quote:

Instead, you'd need to use $xoopsTpl=>getVar(xoops_url) (or whichever SmartyVar you're trying to use) to use it in the block code.


so.. say for the news module... for me to use the smartytag <{$story.title}> or
<{$block.story_title}> in a custom block
how would i use the $xoopsTpl=>getVar(xoops_url) ? to call the file with the smarty tags?
do i need to incude any other .php files?

could you give a basic example?

Thanks heaps


4
mboyden
Re: Custom Blocks - Maybe a hard one
  • 2005/9/3 5:52

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


You can't use smarty in the custom block code you send because the code is outputting to direct HTML, not through using a smarty template. I think I was confused by what you needed to know.

I'm assuming you are trying to fit some database driven content into a custom block. I get that idea from the include file trying to get the output from one of your module pages and then using that info. I'm not sure that including a file that way will do anything for you. You likely need to include the file via the path if anything.

However, assuming you can do that there is a global variable $xoopsTpl that is used to send data to the smarty template. If smarty template uses it, great, if not, it's just a useless piece of information. However, assuming it's been set and exists through some function, if you can call the variable from the template, you can call it programmatically in your code.

For instance:
Quote:

<{$xoops_url}>

would become

$xoopsTpl=>getVar('xoops_url')


The other variables you'll need to know the name of, but they likely aren't block=>....

Likely it's just easier to make the direct calls to the database based on code you find in the module and other blocks and just output the HTML you want.

Or you could write another block for the module and update the module. They are fairly easy to add once you take the time to learn how.

Hope this helps.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

5
Wayde
Re: Custom Blocks - Maybe a hard one
  • 2005/9/3 7:02

  • Wayde

  • Just popping in

  • Posts: 58

  • Since: 2004/9/14


Once again, Thanks for the speedy reply...
helps a bit...
wat im tryin to do is make a block that calls things from the database (eg. a news topic, forum topics, an article) from inside one block...
but maybe thats not possiable?
umm... any ways... ill read up on how to make a block and play round a bit :)

Thanks heaps

Wayde

Login

Who's Online

477 user(s) are online (61 user(s) are browsing Support Forums)


Members: 0


Guests: 477


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Sep 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits