1
wishcraft
SEO URL Routing Module - Clean URLS for ANY MODULE!!

Resized Image
SEO 1.01
SEO URL Routing Module
Sponsored By Chronolabs Co-op

SEO is a module which maintains your URL using apaches Mod Rewrite Function. You can make a plugin for a module that will provide and clean URLs for your site and module so that the system provides clean neat URL for your system. See the example plugin on how to make one for a module.

New Features:
  • Plugins
  • Preloader
  • POST Detection


Download: xoops2.5_seo_1.01.zip (17Kb)
Sourceforge: xoops2.5_seo_1.01.zip (17Kb)
Demo: http://xoops.demo.chronolabs.coop

The following is the example plugin for the module, with one of these you can customise and clean URLs of any XOOPS Module.

    
class ExampleSeoPlugin extends SeoMapping 
    
{
        
// Module Dirname for Plugin
        
var $_mod_dirname 'example';

        
// Default Base of URL if not set in module config 
        
var $_baseurl 'example';

        
// Default End of URL for HTML
        
var $_endofurl_html '.html';
        
        
// Default End of URL for RSS
        
var $_endofurl_rss '.rss';

        
// Default End of URL for PDF
        
var $_endofurl_pdf '.pdf';

        
// Default End of URL for XML
        
var $_endofurl_xml '.xml';

        
// Default End of URL for JPEG
        
var $_endofurl_jpg '.jpg';

        
// Default End of URL for PNG
        
var $_endofurl_png '.png';

        
// Default End of URL for GIF
        
var $_endofurl_gif '.gif';
        
        
// module config variable names for mod rewrite
        
var $_mod_vars =     array(    'baseurl'         =>         '_baseurl',
                                    
'endofurl'         =>         '_endofurl_html',
                                    
'endofurl_rss'     =>         '_endofurl_rss',
                                    
'endofurl_pdf'     =>         '_endofurl_pdf',
                                    
'endofurl_xml'     =>         '_endofurl_xml',
                                    
'endofurl_jpg'     =>         '_endofurl_jpg',
                                    
'endofurl_png'     =>         '_endofurl_png',
                                    
'endofurl_gif'     =>         '_endofurl_gif');
        
        
// module rewrite variable names and file for mod rewrite
        
var $_mod_files =     array(    'A'     =>         array('index.php'     =>         array(        'type'         =>         'html',
                                                                                            
'rewrite'     =>         'A',
                                                                                            
'method'     =>         'get',   /* get/post */
                                                                                            
'this'        =>        array(    
                                                                                                                        
'0'                =>        array('op'    =>    'default'),
                                                                                                                        
'1'                =>        array('op'    =>    'index')    
                                                                                                                ),
                                                                                            
'function'     =>         'getIndexVariablesA'
                                                                                            
'map'         =>         array(    'op'            =>        'arg1'
                                                                                                                        
'cat'            =>        'arg1'
                                                                                                                        
'topic'            =>        'arg3'
                                                                                                                        
'catid'            =>        'arg4'
                                                                                                                        
'subjectid'        =>        'arg5'
                                                                                                                        
'topicid'        =>        'arg6'
                                                                                                                 )
                                                                                )
                                                    ),
                                    
'B'     =>        array('index.php'     =>         array(        'type'         =>         'html',
                                                                                            
'rewrite'     =>         'X',
                                                                                            
'method'     =>         'get',   /* get/post */
                                                                                            
'this'        =>        array(    'op'             =>        'category'),
                                                                                            
'function'     =>         'getIndexVariablesX'
                                                                                            
'map'         =>         array(    'op'            =>        'arg1',
                                                                                                                        
'catid'            =>        'arg2'
                                                                                                                        
'start'            =>        'start'
                                                                                                                        
'limit'            =>        'limit')
                                                                                )
                                                    )
                            );
        
        
        
// module config holder
        
var $_mod_config = array();
        
        
// module holder
        
var $_mod null;
        
        function 
__construct()
        {
            
$module_handler xoops_gethandler('module');
            
$config_handler xoops_gethandler('config');
            
$this->_mod $module_handler->getByDirname($this->_mod_dirname);
            if (
is_object($this->_mod)) 
            { 
                
$this->_mod_config $config_handler->getConfigList($this->_mod->getVar('mid'));
                foreach(
$this->_mod_config as $key => $value
                {
                    if (
in_array($keyarray_keys($this->_mod_vars))&&!empty($value))
                    {
                        
$this->${$this->_mod_vars[$key]} = $value;    
                    }     
                }
                return 
$this;
            } else {
                return 
false;
            }
        }

        
// Required Default Function for getting population URL        
        
function getURL() 
        {
            return 
$this->getDetectedURL($this->_mod_files$this);
        }
        
        
// Required Default Function for getting population target
        
function getTarget() 
        {
            return 
$this->setDetectedVariables($this->_mod_files$this$_GET['plot']);
        }
        
        
// Function to return arguments in order for Rewritemodule A
        
function getIndexVariablesA() {
            
// Normally would access modules classes to find names of categories, items etc for arguments.
            
return array(    'arg1' => 'someone'
                            
'arg2' => 'something'
                            
'arg3' => 'somemore'
                            
'arg4' => '1',
                            
'arg5' => '10'
                            
'arg6' => '1');
        }
        
        
// Function to return arguments in order for Rewritemodule X
        
function getIndexVariablesX() {
            
// Normally would access modules classes to find names of categories, items etc for arguments.
            
return array(    'arg1' => '11'
                            
'arg2' => '3'
                            
'arg3' => '0'
                            
'arg4' => '10');
        }
        
    }
Resized Image
http://www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

2
Mamba
Re: SEO URL Routing Module - Clean URLS for ANY MODULE!!
  • 2012/4/7 23:16

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Simon, installation doesn't work!

You really need to start testing your module before you release them. This is just happening too often!

In this example, your module is for /seo directory, but in your xoops_version.php, it has:

$modversion['dirname'] = "sexy";

Of course, "sexy" is not "seo", so the modules will never install!

OK, I fix it, hoping that this time it will work. But no! :(

I am getting:

Quote:
Fatal error: Can't use function return value in write context in S:\wamp64\www\wish\modules\seo\class\mapping.php on line 183

At this moment I am giving up....

Can you please try to install each model on another XOOPS installation before you release it, to make sure that it works?

I think, you would make a lot of people happy, if your modules start to install correctly.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

3
playsome
Re: SEO URL Routing Module - Clean URLS for ANY MODULE!!
  • 2012/4/9 0:38

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


I think the best bet for url rewriting in xoops is to have it in the core, some sort of rewrite api, then module devs can implement rewriting on a per module basis using the rewrite api, this is similar to how how wordpress does it, I think.

I currently use the xorewite modules hack which is pretty old but seems to work with recent versions, it lets you remove /modules/ as well as rename modules so xtnews can become simply 'news', etc

However there is issue when using the hack and attempting to use any rewriting currently built in to xoops modules.

So yea, I think in the core is the best way to go (its coming in 3.0 i believe?)

4
hipoonios
Re: SEO URL Routing Module - Clean URLS for ANY MODULE!!

Same problem for me. I changed sexy to seo and now it installs with no errors.. But I'm too dumb to figure out how it works.

Documentation please!
I love Xoops!

Login

Who's Online

372 user(s) are online (298 user(s) are browsing Support Forums)


Members: 0


Guests: 372


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