1
jayjay
New Dokuwiki for Xoops release
  • 2008/12/4 16:24

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


Hi everybody!

This my final (as in 'ever') release of Dokuwiki for Xoops.

It is based on the latest stable version Dokuwiki 2008-05-05. Dokuwiki is a great wiki system which can be extended easily with plugins. This version blends Dokuwiki into the XOOPS CMS.

The main difference from the previous release is the sidebar theme. I've also added some bugfixes.

Don't forget to install the latest Xoops Frameworks (Xoops 2.3+ has this included already).

I cannot offer support for this release. It was a project I finished this summer and I have been using it since. Haven't had a single problem

I hope someone will carry on this work for the XOOPS community. I myself am switching to Drupal CMS.




2
jayjay
Re: URL changer
  • 2008/7/28 14:35

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


QSA = query string append

Google is your friend



3
jayjay
Re: URL changer - homepage redirect solution
  • 2008/7/24 7:09

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


This is exactly the code I use. I do not know mastop_publish however. And I also don't understand what this "content module" has to do with masking "modules/mastop_publish" in urls? Could you please explain?

Please check that mod_rewrite is enabled on your Apache web server. You will normally notice this immediately when you use this code



4
jayjay
Re: Xoops 2.3 Wishlist
  • 2008/7/9 7:21

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


Quote:

vamptrix wrote:
Use ReCAPTCHA instead of the now used system, it ain't really protective, ain't it?


+1!



5
jayjay
Re: URL changer - string support for xoRewriteModule
  • 2008/6/23 13:07

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


That's great news!

I hope to test your beta release soon



6
jayjay
Re: URL changer - string support for xoRewriteModule
  • 2008/6/17 9:23

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


Hi trabis,

Thanks for joining the conversation! I love your idea of module-izing this. You make it look easy

I like this style:
https://xoops.org/modules/newbb/viewtopic.php?viewmode=flat&type=&topic_id=64076&forum=30


becomes

https://xoops.org/forum/30-64076-flat/url-changer


So I would ditch the argnames as much as possible (why substitute words like viewtopic or forum when there's no need in mod_rewrite?) and use a combination of slashes and hyphens. I used slashes to delimit the module name, the query string stuff and the page title. This way we limit the amount of special characters in the url, which makes it easier to remember for us humans.

I would go for hyphens because Google will see underscores and some other characters as part of a word and hyphens as word delimiters.

I also suggest attaching (part of) the current pagetitle to the end of each url. I know it can be retrieved with the smarty tag <{$xoops_pagetitle}> in Xoops, but I don't know if you use smarty in your SEO module.

Thanks for your SEO work with Xoops!



7
jayjay
Re: URL changer
  • 2008/6/16 7:23

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


Quote:

frankblack wrote:
So finally I solved it by hacking the pagenav.php.


Hi frankblack!

How did you solve the pagenav problem? I hacked class/pagenav.php and changed this
$this->url $_SERVER['PHP_SELF'].'?'.$extra_arg.trim($start_name).'=';

to this
$this->url $_SERVER['REQUEST_FILENAME'].'?'.$extra_arg.trim($start_name).'=';


REQUEST_FILENAME = REQUEST_URI minus QUERY_STRING

I really hope this (and more) smarty filters get added to the core! If xoRewriteModule makes it to the core, please add the above fix



8
jayjay
Re: URL changer - string support for xoRewriteModule
  • 2008/6/13 13:38

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


Hi Dugris and everyone else!

Thanks for this great smarty output filter! I got it to work on my site in less than half an hour! Beautifully done . For now, this filter only rewrites module folders: 'modules/xigg' changes to 'news' etc.

I was wondering if it were possible to add support for string rewriting? All those funny string characters à la 'cid=0&smode=Weekly&action=View&event_id=7502&caldate=2008-6-13' are driving me crazy! I know it can be done with smarty output filters, but maybe someone can help a hand?

I see two ways to rewrite urls: specific rewrites per-module or global rewrites for selected modules.

For 'global' rewrites I especially like the work done with suin's simplified urls hack:
function simplify_urls($s
{
    
$XPS_URL str_replace('/','/'quotemeta(XOOPS_URL) );
    
$s absolutize($s); // Fix URLs and HTML.
    
    
$in = array(
        
// Search URLs of Xoops's root directry.
          
'/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/([a-zA-Z0-9_-]+).php(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '
/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '/<(a|meta)([^>]*)(href|url)=(['"
]{0,1})'.$XPS_URL.'/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        // Search URLs of modules' directry.
        
'/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '
/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '/<(a|meta)([^>]*)(href|url)=(['"
]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        
'/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '
/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?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]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
    );
    
    
$out = array(
        // Replace URLs of Xoops's root directry.
          '<$1$2$3=$4'.XOOPS_URL.'/$5.html$6$7$8>'
        , '<$1$2$3=$4'.XOOPS_URL.'/$5.$6+$7.html$8$9$10>'
        , '<$1$2$3=$4'.XOOPS_URL.'/$5.$6+$7+$8+$9.html$10$11$12>'
        // Replace URLs of modules' directry.
        , '<$1$2$3=$4'.XOOPS_URL.'/$5+index.htm$6$7$8>'
        , '<$1$2$3=$4'.XOOPS_URL.'/$5+$6.htm$7$8$9>'
        , '<$1$2$3=$4'.XOOPS_URL.'/$5+$6.$7+$8.htm$9$10$11>'
        , '<$1$2$3=$4'.XOOPS_URL.'/$5+$6.$7+$8+$9+$10.htm$11$12$13>'
        , '<$1$2$3=$4'.XOOPS_URL.'/$5+$6.$7+$8+$9+$10+$11+$12.htm$13$14$15>'
        , '<$1$2$3=$4'.XOOPS_URL.'/$5+$6.$7+$8+$9+$10+$11+$12+$13+$14.htm$15$16$17>'
        , '<$1$2$3=$4'.XOOPS_URL.'/$5+$6.$7+$8+$9+$10+$11+$12+$13+$14+$15+$16.htm$17$18$19>'
        , '<$1$2$3=$4'.XOOPS_URL.'/$5+$6.$7+$8+$9+$10+$11+$12+$13+$14+$15+$16+$17+$18.htm$19$20$21>'
    );

    
$s = preg_replace($in$out$s); 
//    
$s = preg_replace('/<([^>]*)>/i','{\1}', $s);
//    
$s = $s.'<!-- Simplified URLs Version 1.1 http://www.suin.jp/ -->';
    return 
$s;    
}


But we could also add module-specific rewrites (in separate config files like coRewriteModule.ini.php?). Just look at the great job Wishcraft did for some popular modules:
This is the modification for SEO paths for News 
RewriteRule 
^news/([a-zA-Z0-%_-]+)/([a-zA-Z0-%_-]+)/comment_([a-zA-Z0-9&%?_.-=]+) modules/news/comment_$[L,NC,QSA]
RewriteRule ^news/([a-zA-Z0-%_-]+)/([a-zA-Z0-%_-]+)/images/(.*) modules/news/images/$2  [L,NC,QSA]
RewriteRule ^news/([a-zA-Z0-%_-]+)/images/(.*) modules/news/images/$2  [L,NC,QSA]
RewriteRule ^news/images/(.*) modules/news/images/$2  [L,NC,QSA]
RewriteRule ^news/([a-zA-Z0-%_-]+)/([a-zA-Z0-%_-]+)/([0-9]+) modules/news/article.php?storycategory=$1&story_title=$2&storyid=$3  [L,NC,QSA]
RewriteRule ^news/([a-zA-Z0-%_-]+)/([a-zA-Z0-%_-]+)/ modules/news/article.php?storycategory=$1&story_title=$2  [L,NC,QSA]
RewriteRule ^news/([a-zA-Z0-%_-]+)/([0-9]+),([0-9]+) modules/news/index.php?storycategory=$1&topic_id=$2&start=$3  [L,NC,QSA]
RewriteRule ^news/([a-zA-Z0-%_-]+)/ modules/news/index.php?storycategory=$1  [L,NC,QSA]
RewriteRule ^news/([0-9]+),([0-9]+) modules/news/index.php?topic_id=$1&start=$2  [L,NC,QSA]
RewriteRule ^newsmodules/news/index.php  [L,NC,QSA]
RewriteRule ^news modules/news/index.php  [L,NC,QSA]
RewriteRule ^news/article.php?storyid=([0-9]+) modules/news/article.php?storyid=$[L,NC,QSA]


We could create a working platform where XOOPS users can add rewrite plugins per module (like the one above). This smarty output filter can save us a lot of time hacking our php files.

Dugris and others, what do you think of this concept?



9
jayjay
Re: URL changer - homepage redirect solution
  • 2008/6/12 9:11

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


Howdie! This is a very nice trick! Had no problems implementing it to all of my modules (so far ).

You may notice that you still get redirected to a '/modules/yourmodule' subfolder when you visit your homepage and have set a 'Module for your start page' in 'Config Panel' - 'General Settings'. This is because this redirect is hardcoded in XOOPS of course.

There is a very easy way to mask this behaviour with Apache mod_rewrite.

First add this to your root .htaccess file:
RewriteEngine on
RewriteCond 
%{REQUEST_URI} !^/.+/ 
RewriteRule ^$ /modules/yourmodule/ [L]


Change 'yourmodule' to whatever module you like (news, wfdownloads...)

Then change the setting 'Module for your start page' to 'None' in 'Config Panel' - 'General Settings'.

This way Apache mod_rewrite will take care of your start page redirect. This will of course only affect your base url, eg.http://www.domain.com/

Edit: Better still, also include root index.(php|html|htm) files

RewriteEngine on
RewriteCond 
%{REQUEST_URI} !^/.+/ 
RewriteRule ^(index(.php|.html|.htm))?$ /modules/yourmodule/ [L]



10
jayjay
Re: URL changer
  • 2008/6/12 7:44

  • jayjay

  • Not too shy to talk

  • Posts: 175

  • Since: 2003/9/10


Quote:

frankblack wrote:
The file header.php inside modules / news (if there is any) should look like this (right before any other code):
if(strpos(getenv('REQUEST_URI'), '/modules/smartsection/') === 0)
{
$oldurl getenv('REQUEST_URI');
$newurl str_replace("modules/news""newmodulename"$oldurl); header("HTTP/1.1 301 Moved Permanently");
header("Location: $newurl");
}


Good luck!


I think you mean:

if(strpos(getenv('REQUEST_URI'), '/modules/news/') === 0)
{
$oldurl getenv('REQUEST_URI');
$newurl str_replace("modules/news""newmodulename"$oldurl); header("HTTP/1.1 301 Moved Permanently");
header("Location: $newurl");
}




TopTop
(1) 2 3 4 ... 12 »



Login

Who's Online

239 user(s) are online (134 user(s) are browsing Support Forums)


Members: 0


Guests: 239


more...

Donat-O-Meter

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

Latest GitHub Commits