Fork me on GitHub
Get XOOPS XOOPSXOOPS FAQFAQ ForumsForums NewsNews ThemesThemes ModulesModules
New Posts New Topics All Posts All Forums Index General Modules Themes Development International XOOPS.org

Search

Donat-O-Meter

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

Learn XOOPS Core

Local Support

Advertisement

XOOPS Code hosted on SourceForge

Cumulus Tag Cloud

- 2 2.5 2.6 3.0 4 6 2013 Abuse adslight Android AntiHarvesting AntiMalUser AntiSpam API Apple Battlefield billige Bootstrap Captcha cell cent chronolabs CHUNG Clicks content CĂN demo docek download Dresses evden eve facebook Fat floor Food for free Gateway Google Guide herre Home Honeypot Human HỘ IP iPhone jQuery Language List log Loss mobile module modules Monster new newbb news NHÀ online PARK phone PHP Prevention profile project Protector publisher Rapid RESIDENCE responsive review Rights rmcommon security Sentry site Smartphone Smoking Solution Spam stem Studio tdmcreate template The Theme themes web weight Wishcraft xoops Xortify XPayment ZendFramework

New Users

Registering user

# 137771

okulsirasi

Welcome to XOOPS!




Bottom   Previous Topic   Next Topic  Register To Post

(1) 2 »


#1 Posted on: 2008/4/20 1:48 Position a block anywhere you want hack................
Yup, you read that right

Here is a little smarty hack to place a chosen block anywhere within a template using a smarty variable.

Normally placements with blocks in XOOPS are very rigid and for the most parts you are confined to the three column system etc. This smarty hack is an attempt to get away from this structure and to use a less rigid approach to block placement. Basically, I will place a chosen block where I want it and not forced into an area that doesn't work for me.

So now you should be able to place a block , just about anywhere you want within your theme.

It works by accessing a smarty function and pulling the information from the database and displaying the block in the chosen area of your theme.

The hack respects the block configurations and settings. So it will show only on the module page/s selected and only to the groups you have given permissions to view. ( Hopefully )

You can download this script from this location!

Please read the readme.txt for installation and usage.

Note: This is just the first version and there maybe some issues that I have not foreseen. So please report back to me any problems, bugs, security issues or features you may like to see within this hack.

Drawback of this:

At the moment the biggest draw back is that the SQL queries will go up the more of these blocks you add onto your site. Yes, it does uses 'Xoops Caching' but that doesn't respect the main issue of getting the block information. I hope to address this fully in another release.

ATB

Catz

Top

Catzwolf
Home away from home
Home away from home
Joined:
2007/9/29 23:21
Group:
Registered Users
Posts: 1317
(Show More) (Show Less)


#2 Posted on: 2008/4/20 5:09 Re: Position a block anywhere you want hack................
thank you catzwolf...i think this should be shipped with core

all this while i use the method by hervet
http://xoops.instant-zero.com/modules ... storyid=20&keywords=block

Top

mjoel
Quite a regular
Quite a regular
Joined:
2006/12/9 8:28
Group:
Registered Users
Posts: 220
(Show More) (Show Less)


#3 Posted on: 2008/4/20 5:56 Re: Position a block anywhere you want hack................
catzwolf, that's very innovative!!!!

I hope, I'll find some time soon to test it.

Top


Please support XOOPS & DONATE
Use 2.5.7 | Debugging | Requests | Bugs
Mamba
Moderator
Moderator
Joined:
2004/4/23 13:58
From Ohio, USA
Group:
Webmaster
Registered Users
Designer Group
Posts: 8055
(Show More) (Show Less)


#4 Posted on: 2008/4/20 12:59 Re: Position a block anywhere you want hack................
Thanks guys,

Hope it helps a little :)

Top

Catzwolf
Home away from home
Home away from home
Joined:
2007/9/29 23:21
Group:
Registered Users
Posts: 1317
(Show More) (Show Less)


#5 Posted on: 2008/4/20 16:18 Re: Position a block anywhere you want hack................
Thanks catzwolf_ !

Another alternative is using conditions inside the theme:

Use this where the block would display:
Quote:

<{foreach item=block from=$xoops_lblocks}>
<{if $block.title == "my block title"}>
<{$block.content}>
<{/if}>
<{/foreach}>


And then change the left column code:
Quote:

<{if $xoops_showlblock == 1}>
<td id="leftcolumn">
<!-- Start left blocks loop -->
<{foreach item=block from=$xoops_lblocks}>
<{if $block.title != "my block title"}>
<{include file="$xoops_theme/theme_blockleft.html"}>
<{/if}>
<{/foreach}>
<!-- End left blocks loop -->
</td>
<{/if}>


In the block admin I would use set "my block title" to display in the left column.

Top


Xoops User Utilities | Xoops Search Engine | vil3/trabisdementia
trabis
Core Developer
Core Developer
Joined:
2006/9/1 13:10
From Portugal
Group:
Webmaster
Registered Users
Posts: 2198
(Show More) (Show Less)


#6 Posted on: 2008/6/13 13:37 Re: Position a block anywhere you want hack................
i tried this hack but it doesnt work.. can you exaplain again pls.

Top


www.cancer-aids.net

www.cinselliksaglik.com

www.konyaninsesi.com
www.psikolojikdanisman.org
www.xoopshocasi.com
orgunozcu
Not too shy to talk
Not too shy to talk
Joined:
2005/9/1 0:21
Group:
Registered Users
Posts: 130
(Show More) (Show Less)


#7 Posted on: 2010/9/2 18:53 Re: Position a block anywhere you want hack................
where can wee find it beacose the link above is not working



Top

geronimo_nd
Just popping in
Just popping in
Joined:
2006/2/5 20:28
Group:
Registered Users
Posts: 10
(Show More) (Show Less)


#8 Posted on: 2010/9/2 22:30 Re: Position a block anywhere you want hack................
the post is outdated

if you are using 2.4

try defacer for block anywhere

http://www.xuups.com/modules/publisher/visit.php?fileid=14


rember to read the readme..there is a guide on how to use the block anywhere hack
Quote:

What is Defacer Module (v1.0 Final) ?
======================

With this Xoops module, your can:
- change themes, metadata and permissions for any given page.
- enable jgrowl redirection system (xoops 2.4 only)
- use blocks anywhere (xoops 2.4 only)



Requirements
====================

Works in 2.4.x, xoops 2.3.x, xoops 2.2.x, xoops 2.0.18 & up, ????? 1.x

Others cms versions were not tested.

Php5 only




How to install Defacer
====================

Copy defacer folder into the /modules directory of your website.
Then log in to your site as administrator, go to System Admin > Modules, look for the defacer
icon in the list of uninstalled modules and click in the install icon.
Follow the directions in the screen.


ATENTION, if you are NOT using xoops 2.4 or ????? 1.1
you have to add a line in header.php and footer.php at the root of your instalation

In yoursite/header.php paste the line

@include_once XOOPS_ROOT_PATH . '/modules/defacer/include/beforeheader.php';

right after

defined("XOOPS_ROOT_PATH") or die( 'XOOPS root path not defined' );

In yoursite/footer.php paste the line

@include_once XOOPS_ROOT_PATH . '/modules/defacer/include/beforefooter.php';

right after

if (!defined("XOOPS_ROOT_PATH")) {
die("XOOPS root path not defined");
}




Tips
=======
When creating pages you can use '*' symbol in the url field to match any url.

You should use relative paths
If you select news module your path will be related to yoursite/module/news/
You should add for example
index.php and not modules/news/index.php

System module is relative to root
You can select system module and enter this url to cover all userinfo pages:
userinfo.php*

Tips for blocks anywhere (xoops 2.4 only)
=========
Just prefix your block title with an underscore and you will be able to use it
has a smarty variable inside your theme or template
Example:
-Edit User menu block and rename it to _User Menu
-Take notice of the "bid" in the url, in this case it is '1':
modules/system/admin.php?fct=blocksadmin&op=edit&bid=1
-Usage on theme/template:
<{$xoops_block_1.title}> --> echos User Menu
<{$xoops_block_1.content}> --> echos the block content


Limitations
========

The block for changing themes is deactivated when using Defacer Theme Changer.



Feedback
========

Please use http://www.xuups.com (xoops user utilities)



Top

jimmyx
Quite a regular
Quite a regular
Joined:
2007/7/17 21:35
Group:
Registered Users
Posts: 337
(Show More) (Show Less)


#9 Posted on: 2013/4/25 20:21 Re: Position a block anywhere you want hack................
Quote:

mjoel wrote:
thank you catzwolf...i think this should be shipped with core

all this while i use the method by hervet
http://xoops.instant-zero.com/modules ... storyid=20&keywords=block



the website is no longer available but i managed to backup it from archive.org


i like this method because we can use it in php block...where trabis defacer anywhere block can only be use in theme.html or smarty template

----------------------------------------------------------------------

How to display a dynamic content in yoaur theme (outside Xoops blocks) ? - Xoops Tips - News
Xoops Tips : How to display a dynamic content in yoaur theme (outside Xoops blocks) ?
Posted by Herve on 2007/8/25 19:39:06 (383 reads) News by the same author

In a previous article, I was talking to you of the release of one of my modules, Boox, with which you can manage static content which is not approachable by Xoops.

The module is very useful but for this moment you can't manage dynamic content.

It could be useful if you could put in your site's theme, the content from any Xoops module.

I'm showing you a solution on which I have worked.


Before all, please don't ask me how to do it for any other Xoops module, search by yourself, it's more interesting
and it's not hard

A customer for which I am working, wanted to display partners (from the Xoops Smartpartner module) inside the header of his site.

This header does not contains Xoops blocks and this last can't display blocks to this place.


After I had imagine many solutions, I have decided to keep the partners modules so that my customer works in a user interface he used to see.

So, partners are created and managed from the Xoops backoffice, inside the SmartPartner module, but it's another solution which will display partners.

In fact, I'm going to bringback the module's block content !

1/ First, set the block's parameters from the Xoops blocks manager as if you wanted to use it "normally".

For this moment, set the block as visible (we will deactivate it later). In my case, I have set and display the block so show partners.


2/ Once you have done it, go in you database with, for example, PhpMyadmin,
and look at the content of the xoops_newblocks (replace xoops with the prefix you used during your website's installation)

Search for the visibles blocks, you can do it simply with a such query :
SELECT * FROM `xoops_newblocks` WHERE `visible` = 1

Then locate (with its name), the block you made visible in the point 1 and copy somewhere
the content of the field options, in my case it was :
1|0|1|1|id|DESC|1

Copy also the content of the following fields (I have wrote their name and their content) :

dirname : smartpartner
func_file : partners_list.php
show_func : b_partners_list_show
template : partners_block_list.html

3/ Go back in the Xoops blocs manager and hide the block you activated in the point 1

4/ Edit your theme (the file theme.html) and write this where you want to see the block's content :
Quote:


<{php}>
include XOOPS_ROOT_PATH.'/mainfile.php';
include_once XOOPS_ROOT_PATH.'/class/template.php';
include_once(XOOPS_ROOT_PATH.'/modules/smartpartner/blocks/partners_list.php');
$result = b_partners_list_show(explode('|','1|0|1|1|id|DESC|1'));
$tpl = new XoopsTpl();
$tpl->assign('block', $result);
$tpl->display('db:partners_block_list.html');
<{/php}>

The red parts must be replaced with the informations you get in the point 2

Don't forget to update your site (and may be to remove the content of the templates_c folder).

That's all !

---------------------------------------------------------------------------




Top

blackrx
Not too shy to talk
Not too shy to talk
Joined:
2008/2/5 11:30
Group:
Registered Users
Posts: 195
(Show More) (Show Less)


#10 Posted on: 2013/4/25 22:34 Re: Position a block anywhere you want hack................
@blackrx:
this topic is very old.
besides the block anywhere hack was implemented in the core 2.5.5 so you can use it with the core.


Top

irmtfan
Module Developer
Module Developer
Joined:
2003/12/7 14:14
From In the middle of nowhere
Group:
Registered Users
Community Coordinator (temporary)
Posts: 3367
(Show More) (Show Less)




(1) 2 »



You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You can vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.

[Advanced Search]