Static Pages
Maintained by
Alexander Bias, Moodle an Hochschulen e.V.
Moodle plugin which displays static information pages which exist outside any course, imprint or faq pages for example, complete with Moodle navigation and theme
Comments
Comments are no longer open for new posts. Existing comments remain available to read.
Thanks for the quick reply. When I do as you suggest I now get a nicely formatted moodle themed page saying 'page not found'. This is even more maddening now because I can see that the formatting part of the plugin works nicely but its not finding the page. The page of course is there: path moodledata/staticpage
I have full rights via EasyAppache on my hosted server, but did not find anything related to mod_rewrite that I can enable. where should i look next.
Thanks as always
Oscar
could you please disable "Force Apache mod_rewrite" in the Plugin's settings and check if your FAQ page is available on the static page's normal URL (/local/staticpage/view.php?page=pagename)?
If yes, there's a problem with your rewrite rules in your webserver.
If no, there's a general problem with the plugin which we'll have to check.
Alex
First, thank you for developing the plugin. This functionally is needed by lots of us moodle users.
Just installed and configed the newest version of the plugin, strictly following the README including the mod_rewrite code. Getting the "Not Found" error on my FAQ page, and within the plugin getting the error below:
"The document should be available to at the following clean URL, but actually a browser won't be able to download and view it (perhaps there is something wrong with your webserver or mod_rewrite configuration - see README file for details):"
What am I missing? Thanks in advance. moodledata is under the root folder, not in the public_html
Oscar
sorry for the big delay since my last post. Finally, I had the possibility to look at local_staticpage again.
If you are running Moodle in a subdirectory, I think you should simply use the following Rewrite rule:
RewriteRule ^/yoursubdirectory/static/(.*)\.html$ /yoursubdirectory/local/staticpage/view.php?page=$1&%{QUERY_STRING} [L]
If you want a general rule, no matter what the subdirectory is named, you could try
RewriteRule ^(.*)/static/(.*)\.html$ $1/local/staticpage/view.php?page=$2&%{QUERY_STRING} [L]
Please note that there is a new plugin version in the Moodle plugins repository with the following features which have been requested by you here in the comments:
- Add an option to set the data source of document title, document heading and breadcrumb item title
- Check availability of static page directly on settings page, show error if page isn't downloadable
Alex
RewriteRule ^static/(.*)?.html$ /local/staticpage/view.php?page=$1&%{QUERY_STRING} [L]
Is this correct? It seems to work on a 'rewrite tester' that I had a go on to develop this rule. The one provided in the readme file for this plugin did not seem to work.
the update only contains the extra character support (see Release notes on https://moodle.org/plugins/pluginversion.php?id=3558 for details) and a minimum Moodle Version of 2.5.1.
I'm sorry that the other things you requested are still not finished - it's no big deal implementing, but I'm too busy at the moment.
Does the new update involves only the extra character support ?
as I have already done that.. do I have to update to this ?
This is the link :-
http://www.pharmaglimps.com/local/staticpage/view.php?page=package and link of scrrenshot is :- http://imgur.com/Fyb3asn
please help thanks
new version for Moodle 2.5 is out with a fix for - and _ characters in filenames.
All other things (improved mod_rewrite support, support for title tags) are not forgotten and will be there in a few days.
Alex
Now just waiting for the mod_rewrite fix..
Thanx
please have a look at the plugin's README file:
"local_staticpage will use the first h1 tag as heading, title and breadcrumb of the resulting Moodle page.
If there is no h1 tag, the heading, title and breadcrumb of the resulting Moodle page will be set to the pagename derived from the document filename."
When I coded local_staticpage some time ago, using the first h1 was a good solution for me. As many more others start using this plugin, I think it does not fit everyone's need.
Would it be ok if a add a plugin setting to the next release which lets you decide if you want to use the first h1 tag or the title tag as page title?
Alex
Is there a way to make the page title to be something else from the file name itself ?
For Ex: if want a page termsandconditions or terms_and_conditions.html the same name comes as the title of the page which doesn't look good!
Please look into this also..
thank you very much for this comment. You are completely right, I will change the parameter type for the next version of the plugin (which will be released for Moodle 2.5 in a few days). In the meantime, you can change the parameter type by yourself as you described to support hyphens and underscores in staticpage URLs. I will also add a hint in the README which characters are allowed for staticpage URLs.
Sorry that I wasn't aware of the SEO topic, I only intended staticpage to use for simple URLs like "impress.html" or "contact.html".
FYI: There is another problem with the plugin when Moodle is installed in a subdirectory. Staticpages work with the "normal URLs" (/local/staticpage/view.php..., but not with the Rewrite rule. I will try to adress this in the next version, too.
Alex
To anyone who has a "Page Not Found" Error, please note that in the file view.php the code:
// Get requested page's name
$page = required_param('page', PARAM_ALPHA);
Must be changed to $page = required_param('page', PARAM_ALPHAEXT);
If your filename has either underscores or hyphens within them, i.e: My-Heavyrank-Page.html
From the Moodle docs:
* PARAM_ALPHAEXT the same contents as PARAM_ALPHA plus the chars in quotes: "_-" allowed
So Alex seeing as how this is for SEO purposes and those kind of URLS get the most SEO bang for the buck, it would probably be safe to presume that PARAM_ALPHAEXT would be preferable to use as it is makes your SEO plug-in even more SEO friendly.
-Justin Brylski