Hello,
I've recently upgraded my PostNuke 0.764 site to Zikula 1.1.1 (at my local computer, not in a production site) and now I have a doubt:
At my PostNuke site, Short-URLs are activated, so the permalinks of the PNphpBB2 forum are like these ones:
Forum main page -> mysite.com/PNphpBB2.html
Sub-Forum main page -> mysite.com/PNphpBB2-viewforum-f-17.html
Post -> mysite.com/PNphpBB2-viewtopic-t-6649.html
I have activated the Short-URLs too at the upgraded site (Zikula 1.1.1) but the permalinks of the forum don't change before and after the Short-URLs are working. They are always like these ones:
Forum main page -> mysite.com/PNphpBB2/
Sub-Forum main page -> mysite.com/index.php?name=PNphpBB2&file=viewforum&f=17
Post -> mysite.com/index.php?name=PNphpBB2&file=viewtopic&t=6649
Is there any way to solve this problem?
Thanks.
PS: I posted this topic at the Zafenio forums 2 days ago, but nobody has answered yet :(
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- internetking created topic »password problem« 25. May
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
- mdee created topic »How to implement returnpage ?« 25. May
- nestormateo responded to »Fillters in Clip« 24. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
PNphpBB2 and Short-URLs in Zikula 1.1.1
-
- Rank: Freshman
- Registered: Sep 10, 2004
- Last visit: Apr 23, 2010
- Posts: 96
-
- Rank: Team Member
- Registered: Feb 27, 2005
- Last visit: Apr 12, 2010
- Posts: 665
If you use file-based short-urls in your Settings, and make sure the correct .htaccess is copied from /docs to your site root, then this should work out of the box.
--
-- Teb
-- Dutch Zikula Community
Support questions in a Personal Message will be ignored. Use the forums at all times! -
- Rank: Freshman
- Registered: Sep 10, 2004
- Last visit: Apr 23, 2010
- Posts: 96
Thanks for your answer Teb.
I've been using PostNuke since 2002 as a blog platform + a forum. Now, with the upgrade to Zikula, I'd like to have directory generated short-urls for the news and mantain the same kind of short-urls for the forum. Is it possible? -
- Rank: Team Member
- Registered: Feb 27, 2005
- Last visit: Apr 12, 2010
- Posts: 665
No this is not possible on a per-module basis through a setting or something. It's either / or, not both in this case, unless you completely customize it yourself. There is a wiki page about shorturls that has a link to a forum-post I did earlier, with additional hints about customization.
Remember that you need to edit a .htaccess file (and have some knowledge about mod_rewrite) and writing a outputfilter (knowledge about Smarty)
--
-- Teb
-- Dutch Zikula Community
Support questions in a Personal Message will be ignored. Use the forums at all times! -
- Rank: Freshman
- Registered: Sep 10, 2004
- Last visit: Apr 23, 2010
- Posts: 96
-
- Rank: Freshman
- Registered: Sep 10, 2004
- Last visit: Apr 23, 2010
- Posts: 96
I've been working on this topic for the last two days and now I have some doubts I hope you can solve. This is what I've done:
As Ted explained at this post, these are the steps I've followed:
·I've created an outputfilter.shorturls.php file
·Then, I've gone to 'Admin Menu -> Content -> Theme -> I've selected my theme -> Page Configurations' and I've modified the page configuration for home.ini, news.ini, master.ini and forum.ini, writting the outputfilter's name (shorturls) of the file I'd created previously
·Finally, I've added some lines of code to the the file 'shorturls.directory.htaccess' located at the '/docs' directory, I've saved it, then I've changed its name to '.htaccess' and I've placed it at the site root
This is the code of the 'outputfilter.shorturls.php' that I've created:
Quote
function smarty_outputfilter_shorturls($source, &$Smarty)
{
$baseurl = pnGetBaseURL();
$type = FormUtil::getPassedValue('type', 'user', 'GETPOST');
$extension = pnConfigGetVar('shorturlsext');
$prefix = '|"(?:'.$baseurl.')?';
$entrypoint = pnConfigGetVar('entrypoint', 'index.php');
$in = array(
$prefix . $entrypoint . '\?name=PNphpBB2"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=index"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=([\w\d\.\:\_\/]+)"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)"|'
);
$out = array(
'"PNphpBB2.'.$extension.'"',
'"PNphpBB2.'.$extension.'"',
'"PNphpBB2-$1.'.$extension.'"',
'"PNphpBB2-$1-$2-$3.'.$extension.'"',
'"PNphpBB2-$1-$2-$3-$4-$5.'.$extension.'"',
'"PNphpBB2-$1-$2-$3-$4-$5-$6-$7.'.$extension.'"',
'"PNphpBB2-$1-$2-$3-$4-$5-$6-$7-$8-$9.'.$extension.'"'
);
$source = preg_replace($in, $out, $source);
return $source;
}
?>
And these are the lines I've added to the '.htaccess' file:
Quote
# PNphpBB2 forums
RewriteRule ^PNphpBB2\.html$ index.php?name=PNphpBB2 [L,NC,NS]
RewriteRule ^PNphpBB2\.html$ index.php?name=PNphpBB2&file=index [L,NC,NS]
RewriteRule ^PNphpBB2-([^-]+)\.html$ index.php?name=PNphpBB2&file=$1 [L,NC,NS]
RewriteRule ^PNphpBB2-([^-]+)-([^-]+)-([^-]+)\.html$ index.php?name=PNphpBB2&file=$1&$2=$3 [L,NC,NS]
RewriteRule ^PNphpBB2-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)\.html$ index.php?name=PNphpBB2&file=$1&$2=$3&$4=$5 [L,NC,NS]
RewriteRule ^PNphpBB2-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)\.html$ index.php?name=PNphpBB2&file=$1&$2=$3&$4=$5&$6=$7 [L,NC,NS]
RewriteRule ^PNphpBB2-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)\.html$ index.php?name=PNphpBB2&file=$1&$2=$3&$4=$5&$6=$7&$8=$9 [L,NC,NS]
I suppose that I'm doing something wrong, but I don't know exactly what. Any idea?
Thanks in advance. -
- Rank: Team Member
- Registered: Feb 27, 2005
- Last visit: Apr 12, 2010
- Posts: 665
I did almost the same thing just a few hours ago, wanting to know if it worked. And it did! So, the steps you did were exactly as I have pictured them.
(Almost) the only difference is that I renamed my plugin differently (besides on extra if-statement, and additional rules for urls with page-anchors). So, change your filename from "outputfilter.shorturls.php" to "outputfilter.customurls.php". Change the function-name to function smarty_outputfilter_customurls in the file accordingly, and change the call from 'shorturls' to 'customurls' in your themes' pageconfigurations.
The placement of the rewrite-rules is quite crucial. You should place this section of rules above "# General rules for modules with index.php?name=...". Also, the second rule in your .htaccess can be removed, as apache's rewritemodule will never get there (it is the same as the line above it).
For completeness, I pasted my code for PNphpBB2 below:
.htaccess
# General rules for PNphpBB2
RewriteRule ^PNphpBB2\+([^-]+)\.p?HTML?$ index.php?name=PNphpBB2&req=$1 [L,NC,NS]
RewriteRule ^PNphpBB2\.p?HTML?$ index.php?name=PNphpBB2 [L,NC,NS]
RewriteRule ^PNphpBB2-([^-]+)\.p?HTML?$ index.php?name=PNphpBB2&file=$1 [L,NC,NS]
RewriteRule ^PNphpBB2-([^-]+)-([^-]+)-([^-]+)\.p?HTML?$ index.php?name=PNphpBB2&file=$1&$2=$3 [L,NC,NS]
RewriteRule ^PNphpBB2-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)\.p?HTML?$ index.php?name=PNphpBB2&file=$1&$2=$3&$4=$5 [L,NC,NS]
RewriteRule ^PNphpBB2-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)\.p?HTML?$ index.php?name=PNphpBB2&file=$1&$2=$3&$4=$5&$6=$7 [L,NC,NS]
outputfilter.customurls.php
function smarty_outputfilter_customurls($source, &$Smarty)
{
// If you control the server, it is preferable for better performance to put rewrite rules
// from the htaccess file into main configuration file, httpd.conf.
// get the site's base uri, eg /nuke/ for root-relative links
$baseurl = pnGetBaseURL();
$type = FormUtil::getPassedValue('type', 'user', 'GETPOST');
if (pnConfigGetVar('shorturlstype') == 1 && $type !== 'admin' && !stristr(pnServerGetVar('QUERY_STRING'), 'admin')) {
$extension = pnConfigGetVar('shorturlsext');
$prefix = '|"(?:'.$baseurl.')?';
$entrypoint = pnConfigGetVar('entrypoint', 'index.php');
$in = array(
$prefix . $entrypoint . '\?name=PNphpBB2"|',
$prefix . $entrypoint . '\?name=PNphpBB2[#]([\w\d]*)"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=index"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=index[#]([\w\d]*)"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=([\w\d\.\:\_\/]+)"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=([\w\d\.\:\_\/]+)[#]([\w\d]*)"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)[#]([\w\d]*)"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)[#]([\w\d]*)"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)"|',
$prefix . $entrypoint . '\?name=PNphpBB2&(?:amp;)?file=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)&(?:amp;)?([\w\d\.\:\_\/]+)=([\w\d\.\:\_\/]+)[#]([\w\d]*)"|'
);
$out = array(
'"PNphpBB2.'.$extension.'"',
'"PNphpBB2.'.$extension.'#$1"',
'"PNphpBB2.'.$extension.'"',
'"PNphpBB2.'.$extension.'#$1"',
'"PNphpBB2-$1.'.$extension.'"',
'"PNphpBB2-$1.'.$extension.'#$2"',
'"PNphpBB2-$1-$2-$3.'.$extension.'"',
'"PNphpBB2-$1-$2-$3.'.$extension.'#$4"',
'"PNphpBB2-$1-$2-$3-$4-$5.'.$extension.'"',
'"PNphpBB2-$1-$2-$3-$4-$5.'.$extension.'#$6"',
'"PNphpBB2-$1-$2-$3-$4-$5-$6-$7.'.$extension.'"',
'"PNphpBB2-$1-$2-$3-$4-$5-$6-$7.'.$extension.'#$8"'
);
// perform the replacement
$source = preg_replace($in, $out, $source);
}
// return the (modified) source
return $source;
}
edited by: Teb, Mar 28, 2009 - 02:59 AM
--
-- Teb
-- Dutch Zikula Community
Support questions in a Personal Message will be ignored. Use the forums at all times! -
- Rank: Freshman
- Registered: Sep 10, 2004
- Last visit: Apr 23, 2010
- Posts: 96
Quote
So, change your filename from "outputfilter.shorturls.php" to "outputfilter.customurls.php". Change the function-name to function smarty_outputfilter_customurls in the file accordingly, and change the call from 'shorturls' to 'customurls' in your themes' pageconfigurations.
THIS was the problem. Now everything works fine
Thanks Teb
-
- Rank: Freshman
- Registered: Sep 10, 2004
- Last visit: Apr 23, 2010
- Posts: 96
Hello,
I've finished the upgrading process from PostNuke 0.764 to Zikula 1.1.1 and everything works ok except one thing. As I explained previously into the first posts of this thread, I've been using PN as a blog platform + a forum for many years and I want to do the same with ZK.
At my PostNuke site, I use short-URLs and the permalinks of the PNphpBB2 forum are like these ones:
· Forum main page -> mysite.com/forums.html
· Sub-Forum main page -> mysite.com/forums-viewforum-f-17.html
· Post -> mysite.com/forums-viewtopic-t-6649.html
I want to preserve this kind of permalinks and use directory based short-URLs for the rest of the site, so I followed the instructions of Teb and I created an outputfilter and modified the .htaccess file. I thought that everything worked fine, but now I discovered a problem related to the permalinks of the PNphpBB2 forum that I don't understand.
I've made a little summary:
· With short-URLs not activated -> permalinks of the forum work ok
· With file short-URLs activated -> permalinks of the forum work ok
· With directory short-URLs activated and selecting PNphpBB2 as the "module to use when permalink contains no module name" ('Settings' menu at the administration panel) -> permalinks of the forum work ok
· With directory short-URLs activated and selecting News as the "module to use when permalink contains no module name" (this is the configuration I want to use at my website) -> permalinks of the forum doesn't work and:
a) If the permalinks are like "http://mysite.com/forums-viewtopic-p-27842.html" (it's just an example) the system shows an error into the "master.html" template instead of the "PNphpBB2.html" template
b) If the permalinks are like "http://mysite.com/PNphpBB2-viewtopic-p-27842.html" the error apears into the "PNphpBB2.html" template
The error is this one (I've activated the 'development' mode at config.php as Mateo has told me):
Quote
Error! Could not do what you wanted. Please check your input. in [News_user_display] at line 378 in file /public_html/modules/News/pnuser.php.
One more thing: with directory short-URLs activated, if I select, for example, 'Pages' insted of 'News' as the "module to use when permalink contains no module name", when I try to enter the forum, this is the message that appears:
Quote
Error! Could not do what you wanted. Please check your input. in [pages_userapi_get] at line 128 in file /public_html/modules/Pages/pnuserapi.php.
Do you know why these messages appear, why are showed only in some circumstances and in different templates depending of the words I use in the permalinks of the forum?
Thanks.
edited by: Abadia, Apr 14, 2009 - 04:06 PM -
- Rank: Team Member
- Registered: Feb 27, 2005
- Last visit: Apr 12, 2010
- Posts: 665
Quote
I want to preserve this kind of permalinks and use directory based short-URLs for the rest of the site, so I followed the instructions of Teb and I created an outputfilter and modified the .htaccess file.
My instructions were solely based on the setting of file-based short-urls. I am having doubts if it is even possible to combine file- and directory-based urls, since most of directory-based short-urls is handled internal in the system, and not just a rewrite of the output / input.
You should first make sure that directory-based short-urls work as desired for your News and Pages module, without any additional filters. IIRC, the urls for PNphpBB2 are not rewritten in this case (old-style module urls, but this might change for future versions of Zafenio). So, it might be possible to activate the outputfilter afterwards. Be sure to remove the pnConfigGetVar('shorturlstype') == 1 check from the outputfilter. Then add the specific lines to a working (empty?) .htaccess file.
Not guaranteed to work...
--
-- Teb
-- Dutch Zikula Community
Support questions in a Personal Message will be ignored. Use the forums at all times! -
- Rank: Freshman
- Registered: Sep 10, 2004
- Last visit: Apr 23, 2010
- Posts: 96
Quote
My instructions were solely based on the setting of file-based short-urls.
Ups, I misunderstood you. At the third post of this topic I specified that I wanted to use directory short-urls, so I thought you were talking about the same kind of short-urls.
Quote
You should first make sure that directory-based short-urls work as desired for your News and Pages module, without any additional filters. IIRC, the urls for PNphpBB2 are not rewritten in this case (old-style module urls, but this might change for future versions of Zafenio). So, it might be possible to activate the outputfilter afterwards.
The News and Pages modules work fine with directory based short-urls. PNphpBB2, with the outputfilter and .htaccess files I've modified, also works fine but only if I select PNphpBB2 as the "module to use when permalink contains no module name" at 'Admin -> Settings' menu. If I select any other module, ZK shows the error messages I specified at the above post.
Quote
Be sure to remove the pnConfigGetVar('shorturlstype') == 1 check from the outputfilter. Then add the specific lines to a working (empty?) .htaccess file.
The outputfilter I've been using during the last weeks is the one I've posted at the sixth post (the one without the 'if' statement).
I think it's obvious that the system doesn't recognize the PNphpBB2 permalinks that I'm passing to it, so today I've modified the outputfilter and .htaccess files adding the term "PNphpBB2/" at the beginning of the permalinks, but ZK still gives me the same error messages.
Any idea on what I have to do?
Thanks.
edited by: Abadia, Apr 16, 2009 - 12:21 AM
- Moderated by:
- Support
Users on-line
- 0 users
This list is based on users active over the last 60 minutes.
