11
abrizan
Re: Include block by hand in theme
  • 2007/1/21 12:41

  • abrizan

  • Just popping in

  • Posts: 82

  • Since: 2005/11/14


I had the same problem so I came up with this php snippet. Just put it right in before your HTML tag:

<{php}>
//*********************   custom main menu    *********************//
// There must be an easier way to achieve this but this is what I  //
// came up with. Smarty programming seems to be acting wierd in a  //
// template so i have to do it the old fashioned way: straight PHP //
// Broke up the menu building into simple functions to keep HTML   //
// tags out of the menu code. ONLY EDIT THE $htmlcode="..."; LINES //
// It's dirty but it works.                                        //
// -xoopstuner                                                     //
//*****************************************************************//

//mini template for custom main menu
function xtnrMenu($Menu,$activeModuleName,$activeModuleLink,$activeModuleSublinks){
    
$htmlcode="
    | <a href="
.XOOPS_URL." >Home</a> |$Menu
    "
;
    return 
$htmlcode;
}


//mini template for menu link and sublinks placement
function xtnrMenuLink($linktitle,$link,$sublinks){
    
$htmlcode="
    <a href=
$link >$linktitle</a> |
    "
;
    return 
$htmlcode;
}


//mini template for menu link when there are no sublinks, active takes precidence
function xtnrMenuLinkEmpty($linktitle,$link){
    
$htmlcode="
    <a href=
$link >$linktitle</a> |
    "
;
    return 
$htmlcode;
}


//mini template for menu link and sublinks placement for currently selected module
function xtnrMenuLinkActive($linktitle,$link,$sublinks){
    
$htmlcode="
    <strong><a href=
$link >$linktitle</a></strong> |
    "
;
    return 
$htmlcode;
}


//mini template for sublinks 
function xtnrMenuSublink($linktitle,$link){
    
$htmlcode="
    ---<a href=
$link >$linktitle</a><br>
    "
;
    return 
$htmlcode;
}


//mini template for sublinks of currently active module
function xtnrMenuSublinkActive($linktitle,$link){
    
$htmlcode="
    ---<a href=
$link >$linktitle</a>-active<br>
    "
;
    return 
$htmlcode;
}



    
    
//modified main menu block code
    
global $xoopsUser,$xoopsModule,$customMainMenu,$activeModuleName,$activeModuleLink,$activeModuleSublinks,$temp;
    
$block = array();
    
$block['lang_home'] = _MB_SYSTEM_HOME;
    
$block['lang_close'] = _CLOSE;
    
$module_handler =& xoops_gethandler('module');
    
$criteria = new CriteriaCompo(new Criteria('hasmain'1));
    
$criteria->add(new Criteria('isactive'1));
    
$criteria->add(new Criteria('weight'0'>'));
    
$modules =& $module_handler->getObjects($criteriatrue);
    
$moduleperm_handler =& xoops_gethandler('groupperm');
    
$groups is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
    
$read_allowed =& $moduleperm_handler->getItemIds('module_read'$groups);
    foreach (
array_keys($modules) as $i) {    
        if (
in_array($i$read_allowed)) {
            
$modulesname $modules[$i]->getVar('name');
            
$moduledirectory $modules[$i]->getVar('dirname');
            
$sublinks =& $modules[$i]->subLink();
            
$sublinkshtmlout '';


            if (empty(
$xoopsModule)) {
                
//system module; fill in defaults
                
$mid=-1;
                
$activeModuleName="Home";
                
$activeModuleLink=XOOPS_URL;
                
$activeModuleSublinks='';
            } else {
                
$mid=$xoopsModule->getVar('mid');
            }
            

            
//build sublinks for module
            
if ((count($sublinks) > 0)) {
                if (
$i == $mid) {
                    foreach(
$sublinks as $sublink){
                        
//current active  module
                        
$sublinkshtmlout =$sublinkshtmlout.xtnrMenuSublinkActive ($sublink['name'],XOOPS_URL.'/modules/'.$modules[$i]->getVar('dirname').'/'.$sublink['url'] );
                        
$activeModuleSublinks =$activeModuleSublinks.xtnrMenuSublinkActive ($sublink['name'],XOOPS_URL.'/modules/'.$modules[$i]->getVar('dirname').'/'.$sublink['url'] );
                    }    
                } else {
                    foreach(
$sublinks as $sublink){
                        
//not current active module
                        
$sublinkshtmlout =$sublinkshtmlout.xtnrMenuSublink     ($sublink['name'],XOOPS_URL.'/modules/'.$modules[$i]->getVar('dirname').'/'.$sublink['url'] );
                    }
                }
            } else {
                
$block['modules'][$i]['sublinks'] = array();
            }


            
            
// Build Main Menu Link From mini template
            
if ($i == $mid) {    
                
//current active module
                
$activeModuleName $modulesname;
                
$customMainMenu $customMainMenu.xtnrMenuLinkActive($modulesnameXOOPS_URL.'/modules/'.$moduledirectory$sublinkshtmlout);
                
$activeModuleLink $activeModuleLink.xtnrMenuLinkActive($modulesnameXOOPS_URL.'/modules/'.$moduledirectory$sublinkshtmlout); 
            } else {
                
//not current active module
                
if ($sublinkshtmlout==''){
                    
$customMainMenu =$customMainMenu.xtnrMenuLinkEmpty($modulesnameXOOPS_URL.'/modules/'.$moduledirectory);
                } else {
                    
$customMainMenu =$customMainMenu.xtnrMenuLink($modulesnameXOOPS_URL.'/modules/'.$moduledirectory$sublinkshtmlout);
                }
            }
                                    
        }
    }
    
$customMainMenu xtnrMenu($customMainMenu,$activeModuleName,$activeModuleLink,$activeModuleSublinks);
    
//no output if no modules
    
if (count(array_keys($modules))==0) {$customMainMenu ='';}

<{/
php}>




In the template where I want my custom main menu I put
<{php}>echo ($customMainMenu);<{/php}>


I have used this in a few of my templates, including one which makes a popup menu based on the GOSU menu script in the admin theme of XOOPS 2.2
You shouldn't have to modify anything but the 'mini templates' at the beginning of the script to fit your theme.

You can download a theme with it at www.xoopstuner.com xtnrBusiness is what this is pasted from and xtnrPortable has the popup menu script in it, twice.



12
abrizan
Re: PHP in a block
  • 2006/9/12 19:46

  • abrizan

  • Just popping in

  • Posts: 82

  • Since: 2005/11/14


i'm sure you guessed this, but includes are referenced relative to XOOPS root folder. What you may not realise is that default PHP configs prevent including above your script root.
Check your php.ini. I cant remember which property thoug.
You could, instead, put the include in a folder under xoops.



13
abrizan
Re: New Website - Tennisball Cricket Association
  • 2006/9/1 15:24

  • abrizan

  • Just popping in

  • Posts: 82

  • Since: 2005/11/14


Great use of blocks and styles. Glad to see that you started with a design idea and made a XOOPS theme to match (Not the other way around as I keep seeing). Can I link to this site from www.xoopstuner.com?



14
abrizan
Making a menu in a theme
  • 2006/7/13 19:25

  • abrizan

  • Just popping in

  • Posts: 82

  • Since: 2005/11/14


Is there any way to get all mainmenu links and sublinks (for ALL modules) in a theme. I'm trying to make a menu in a theme without needing any special modules installed.
Even some basic ideas on where to start would be helpful.



15
abrizan
Re: looking for graphicians, help, partnership, cooperation
  • 2006/7/13 19:08

  • abrizan

  • Just popping in

  • Posts: 82

  • Since: 2005/11/14


Just like everyone else I agree that XOOPS needs better themes to at least show how powerful the template engine really is. That's why i started xoopstuner.com.
I've been talking to some artists and got some designs from a guy named karnage. I'll post one of his preliminary designs (psd) on this thread as soon as he makes it available. I'm interested to see what you guys will make of it.



16
abrizan
Re: Integrating GIS and CMS
  • 2006/6/9 15:07

  • abrizan

  • Just popping in

  • Posts: 82

  • Since: 2005/11/14


Great stuff! I think you have a killer app on your hands.



17
abrizan
Xoopstuner.com
  • 2006/6/9 15:02

  • abrizan

  • Just popping in

  • Posts: 82

  • Since: 2005/11/14


Firstly the link: http://www.xoopstuner.com

This is my XOOPS theme/design site which I've been running for a few months now. Traffic is ok but there isn't any community support or feedback at all. Any ideas on how I can encourage some?



18
abrizan
Theme+Template+Block Switcher
  • 2006/5/21 20:04

  • abrizan

  • Just popping in

  • Posts: 82

  • Since: 2005/11/14


I'd like to see a module which would switch Theme, templates and modify blocks all at once based on config scripts. The limitation with XOOPS themes is they are supposed to be used in conjuction with template sets but the themeswitcher ignores template sets. There is probably a good core hack to fix this (when you switch theme you switch to a template set of the same name) but i'd prefer to see a good module to address this oversight in the XOOPS administration design.




TopTop
« 1 (2)



Login

Who's Online

254 user(s) are online (168 user(s) are browsing Support Forums)


Members: 0


Guests: 254


more...

Donat-O-Meter

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

Latest GitHub Commits