Moodle plugins directory: Static Pages | Moodle.org
![Logo](https://moodle.org/pluginfile.php/50/local_plugins/plugin_logo/336/logo.png?preview=thumb)
Static Pages
We have seen Moodle installations where there was a need for displaying static information like an imprint, a faq or a contact page and this information couldn't be added everything to the frontpage. As Moodle doesn't have a "page" concept, admins started to create courses, place their information within these courses, open guest access to the course and link to this course from HTML blocks or the custom menu.
We thought that this course overhead doesn't make sense, so we created this plugin. It is designed to deliver static HTML documents, enriched with Moodle layout and navigation as a standard Moodle page which exist outside any course. Static pages will be available on catchy URLs like http://www.yourmoodle.com/static/faq.html and can be linked from Moodle HTML blocks, from your Moodle theme footer and so on.
Using this plugin, you can create information pages within moodle, but without misusing a whole course just for showing a textbox. It is not meant as a fully featured content management solution, especially as you have to work with raw HTML, but it is quite handy for experienced admins for creating some few static pages within Moodle.
Please see README file for details about the usage and features of this plugin.
No support in the comments section on this page
Please note that we don't provide any support for this plugin in the comments section on this page.
We appreciate your commendation and reviews for this plugin in the comments. For bug reports and support requests, please read the extensive information in the plugin's README file first and create, if needed, a ticket in the bug tracker which is linked below.
Thanks for your cooperation.
I added
RewriteEngine On
RewriteRule ^/static/(.*)\.html$ /local/staticpage/view.php?page=$1&%{QUERY_STRING} [L]
to the .htaccess of the moodle installation directory..
Please help
you have two possibilities to access a static page:
1. Via the "normal link", e.g. http://www.yourmoodle.com/local/staticpage/view.php?page=imprint
2. Via a mod_rewrite link, e.g. http://www.yourmoodle.com/static/imprint.html
As the normal link is working for you, there should be no fundamental problem with local_staticpage.
In addition to the normal link, you can establish a mod_rewrite rule as you did. Could you please tell me the URL you are using to call the static page and which doesn't work?
As soon as you check the checkbox of the "Force Apache mod_rewrite" setting in local_staticpage's settings, the normal link isn't working anymore, only the mod_rewrite links will still work. That's intended behaviour.
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
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
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..
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
Now just waiting for the mod_rewrite fix..
Thanx
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
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
Does the new update involves only the extra character support ?
as I have already done that.. do I have to update to this ?
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.
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.
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
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