1
thoughtscape
Include a block in a theme

Is it possible to include a specific (preferably custom) block directly into a theme?

I have seen posts that suggest taking one of of the block types -- like the center-right block -- and including it in the theme at a specific place. That would work, but seems a little awkward.

What I am looking to do specifically is to develop a custom logon block or search block and then insert that block into the theme by name (or reference).

Is this possible?

thanks

James

2
LazyBadger
Re: Include a block in a theme

Yes, both blocks are ordinary forms, you can design it as you want (and use same form action, as in default block). At least I have embedded search in my themes (embedded login seems as overkill, for me)
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

3
thoughtscape
Re: Include a block in a theme

What do I need to do to insert the block?

I'm not talking about copying the HTML of the block and inserting it directly into the theme. I would like to have the theme include the contents of the block dynamically.

Is that what you are doing?

4
LazyBadger
Re: Include a block in a theme

What it can means: "...theme include the contents of the block dynamically..."? Theme is mostly static content, you can change it in some aspects, but... you have small set of smarty-variables (by default), which can be used as presentation controllers
I have permanent search in my themes in header-area
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

5
thoughtscape
Re: Include a block in a theme

So I can pull in a a set of blocks using the construct:
<{foreach item=block from=$xoops_lblocks}>
....
<{/foreach}>

Or I can hard-code the contents of a block.

But I can't explicitly include a block by name or id.

Unfortunate, but not a critical issue. I'm just trying to modularize things a bit.

Thanks

6
LazyBadger
Re: Include a block in a theme

You can use cycle, you can use hrardcoded HTML - it depends...
Hardcoded HTML will be always on the same place, block-set will change, when your change position of block in admin side (or add remove block from|to used placeholder)
I still can't understand - what you want to do?! Can you describe it in
- short
- simply
- human-ready
words?
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

7
thoughtscape
Re: Include a block in a theme

In the System module is a block named Login.

I would like to explicitly include the template for that block in my theme.

I do not want to copy the template to my theme manually because I would like to use block variables such as $block.lang_username.

Can this be done?

8
LazyBadger
Re: Include a block in a theme

1. You can't use block-level smarty-variables in theme
2. You can have multilanguage elements in theme (not without manual work, as it happens with blocks), but it will require some tricks on site, whre theme will be used (installing and configuring EMLH, Xlanguage...), accoeding to your specification, added to theme's docs
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

9
thoughtscape
Re: Include a block in a theme

That's what I was affraid of. Oh well. As I said, this was something I would like to be able to do. No complaints.
thanks for your help.

10
stefan88
Re: Include a block in a theme
  • 2005/8/2 19:19

  • stefan88

  • Community Support Member

  • Posts: 1086

  • Since: 2004/9/20


Hi,

in my theme I use this:

<table width="100%" height=25px border="0" cellpadding="0" cellspacing="0" id="topbar"
<
tr
<
td width="300" class="headerlogin">
<{if 
$xoops_isuser}>





<{if 
$msgcount 0}>
&
nbsp;<a href="<{$xoops_url}>/viewpmsg.php">
<
img src="<{$xoops_imageurl}>images/prvmsg_on.jpg" alt=You&nbsp;have&nbsp;<{$msgcount}>
&
nbsp;new&nbsp;message border="0" />a>
<{else}>
&
nbsp;<a href="<{$xoops_url}>/viewpmsg.php">
<
img src="<{$xoops_imageurl}>images/prvmsg_off.jpg"
 
alt="You have no new messages" border="0" />a>
<{/if}>

&
nbsp;&nbsp;<a href="<{$xoops_url}>/user.php" align="middle">
<{
$xoops_uname}>a>&nbsp;&nbsp;
<
a href="<{$xoops_url}>/user.php?op=logout">
<
img src="<{$xoops_imageurl}>images/exit_small.jpg" alt="EXIT" border="0" />a
<{else}> 
<
form style="margin-top: 0px; margin-bottom: 0px" 
action="<{$xoops_url}>/user.php" method="post">
&
nbsp;<img src="<{$xoops_imageurl}>images/username_small.jpg" 
alt="Username" border="0" width="16" height="16" align="middle" /> 
<
input name="uname" type="text" value="" size="14" />
<
img src="<{$xoops_imageurl}>images/password_small.jpg" 
alt="Password" border="0" width="16" height="16" align="middle" />
<
input name="pass" type="password" value="" size="12" /> 
<
input name="op" type="hidden" value="login" />
<
input name="submit" type="submit" value="<{$smarty.const._LOGIN}>" />&nbsp
form
<{/if}>td
<
td align="left" class="headercenter"
<{if 
$xoops_isuser}> <{else}> 
<
form style="margin-top: 0px; margin-bottom: 0px" 
action="<{$xoops_url}>/register.php" method="post"
<
input name="submit" type="submit" value="<{$smarty.const._REGISTER}>" /> 
form
<{/if}> td>
<
td width="*" align="right" class="headersearch"
<
form style="margin-top: 0px; margin-bottom: 0px" 
action="<{$xoops_url}>/search.php" method="post">
&
nbsp;&nbsp;
<
a href="<{$xoops_url}>/search.php">
<
img src="<{$xoops_imageurl}>images/search_small.jpg" 
alt="Advanced Search" border="0" width="16" height="16" align="middle" />a>
<
input name="query" type="text" size="15" class="button" /> 
<
input name="action" type="hidden" value="results" />
<
input name="submit" type="submit" value="<{$smarty.const._SEARCH}>" />&nbsp;&nbsp;
form>td
tr
table>


It does more things and you will have to do some changes to use it ... but it is a start :)

Stefan
..

Login

Who's Online

389 user(s) are online (279 user(s) are browsing Support Forums)


Members: 0


Guests: 389


more...

Donat-O-Meter

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

Latest GitHub Commits