Moodle plugins directory: Static Pages | Moodle.org
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.
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
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
it's good that you get a "page not found" error, this tells us that the plugin is working. The "Page not found" error is shown when the plugin tries to find a static page file, but it isn't there or not readable.
Could you please verify:
1. On www.yourmoodleurl.com/admin/settings.php?section=staticpage, the "Document directory" points to the directory on filesystem when your static page's html files are.
2. On www.yourmoodleurl.com/admin/settings.php?section=staticpage, there is a check mark near the "Document directory" setting.
3. In the directory which has been configured in 1., there are some *.html files and these files' permissions are set right, so that the webserver process is able to read them.
If this still doesn't solve the problem:
On www.yourmoodleurl.com/admin/settings.php?section=staticpage, in "document list" section, there are the documents which have been found by the staticpage plugin in the configured directory. Please send me this list (via personal message if you like) so I can have a look at it.
And please send me a directory listing of the directory where your staticpage html files are.
We have to solve this problem with the "normal" URLs first. As soon as static pages work with normal URLs, we can try enabling mod_rewrite URLs.
Alex
I'm having exactly the same issue that Oscar was experiencing. I followed all the verification steps you recommended to him but still got the same error "Page not found." Did you come out with a solution for his problem? Thx.
I identified that there is a problem with my local_staticpage plugin and Bootstrap based Moodle Themes. local_staticpage doesn't respect Theme APIs which have been changed for Bootstrap based themes. Non-Bootstrap based themes work without problems.
I will have a look into this as soon as possible, but as winter term is starting next week, I'd like to ask you for some more days until I get the patch finished.
Alex
1. Filenames cannot contain non-alpha characters. While testing I discovered that my pagenotfound error was due to having numbers in the static file names. So /static1.hmtl and /static2.html return pagenotfound. But /static loads. If /static.html is in place then /static1.html or /static2.html or /static-1.html load the /static.html content. The plugin is parsing out non-alpha characters.
2. Plugin doesn’t recognize the user’s lang setting. I did extensive testing with three static files named mypage.html mypage.en_us.html and mypage.de.html. To help me identify them when rendered I coded title and h1 to contain “English” “English US” and “German” accordingly. Accessing my site as a guest I was delivered the correct file according to the site’s language. With only /mypage.html in place (no en_us or de), that version was rendered regardless of the site’s language setting. With only the en_us version in place, but site set to de I get pagenotfound. Vice versa with de.html and language at en_us. So file language recognition seems to work well. However while logged in, my profile's language setting wasn’t recognized by the plugin. The page is always rendered according to the site's language and my profile language wasn’t respected.
3. Page display breaks with a with a bootstrap-based theme. My theme is customized from Clean (bootstrap base). Afterburner for example works well, assuming the file names are correct. I look forward to your patch to fix this.
Finally regarding apacherewrite. With it turned on or off the clean urls return 404 not found. I’ve tried .htaccess according to the read me:
RewriteEngine On
RewriteRule ^/static/(.*)\.html$ /local/staticpage/view.php?page=$1&%{QUERY_STRING} [L]
And from your comment above:
RewriteEngine On
RewriteRule ^(.*)/static/(.*)\.html$ $1/local/staticpage/view.php?page=$2&%{QUERY_STRING} [L]
This could be an issue with my apache configuration or mod_rewrite as suggested. I just don’t know enough about that to figure it out, yet.
Hopefully my discoveries will benefit someone. I'll watch this plugin and test the new release as soon as it's available.
Thanks,
Darrel
thank you very much for your extensive testing.
1. Oh, that's my fault. The readme says that Alphanumeric pagenames are supported, but indeed only alphabetic pagenames are supported. I will fix this bug in the next version.
2. Your findings are correct - if you want to run staticpages with language detection, you have to make sure that you have a static page file for each language you want to support.
The issue with your profile's language setting: The language setting in your profile defines, as far as I know, which language is selected after you have logged in. When you select a different language in the language switcher, this selection overrides the setting in your profile for the current session. local_staticpage just get's the current selected language from Moodle core, so I think it can't be blamed for failing here
3. Did you try this with the very last version of Moodle 2.5.x? There were problems with Bootstrap based themes, but I think I had fixed them in my plugin in combination with the latest version of Moodle 2.5.
4. Concerning your mod_rewrite issues, I am afraid that I can help you very much. The rewrite rules which I have provided should work for most webserver configurations, if they don't work you should have some Apache knowledge to debug the problems....
Alex
I'm running 2.5.3 Build 20131111. I pulled that last week prior to this plugin.
I'm researching the Apache Rewrite issue. I have my question out to a few Apache message boards and am hoping for an answer. Or perhaps a fellow Moodler can help here.
Apache Rewrite is enabled on my server. It was suggested by my host to add a line to the .htaccess. Options +FollowSymLinks So I added that.
I think I understand the syntax of the suggested RewriteRule line, execpt for &%{QUERY_STRING}. I don't know what that part is for.
Thanks,
Darrel
Just wanted to let you know that I updated to 2.5.3+ (Build: 20131115) but the theme issue persists. You can see how it looks here.
http://wxtrainingnw.com/local/staticpage/view.php?page=readme
I have a 2.6 sandbox installed where I will try your plugin and see what happens. We won't be moving our live site to 2.6 for a while though.
Thanks,
Darrel
when I open the URL which you have provided, I get a nicely looking static page saying:
English page
My test static page.
Do you really think that there is still a problem with bootstrap based themes?
Alex
Here are two screen shots. One of my home page, and one of the static page.
Is this how it looks to you? The static page certainly isn't embedded in the Moodle body as it shows on your FAQ sample. This works well for me in Afterburner. Also with Bootstrap base, which my theme is supposed to be copied from. Perhaps it's an issue with my theme.
Darrel
See here:
Moodle Frontpage: https://moodle.uni-ulm.de/
Static page: https://moodle.uni-ulm.de/static/impressum.html
local_staticpage does _not_ switch themes to display the static page. But it does use a suitable pagelayout "standard" to display the static page.
You said that you use a custom theme which is based on the clean theme. Please check in your custom themes config.php if there is the pagelayout "standard" defined and which template / settings it should use. I assume that your custom theme does not define the standard pagelayout properly, so Moodle falls back to the clean theme for static pages which would explain the theme change.
Alex
Sending me to the config.php solved it for me! According to your Readme file I had added this to config.php within $THEME->layouts = array(
'staticpage' => array(
'file' => 'general.php',
'regions' => array('side-pre'),
'defaultregion' => 'side-pre',
),
After reading more carefully I realize this is for "styling static pages in some special way". I removed those bits and voilå! It looks great!
http://wxtrainingnw.com/local/staticpage/view.php?page=readme
Thanks for helping me so much with this. It will be very useful for us.
Now hopefully I can solve the apache rewrite issue and get pretty urls.
Darrel
great to hear that the plugin finally works for you
Alex
I just solved my .htaccess issue by removing the leading slash before static/ in the RewriteRule
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^static/(.*)\.html$ /local/staticpage/view.php?page=$1&%{QUERY_STRING} [L]
or
RewriteRule ^(.*)static/(.*)\.html$ $1/local/staticpage/view.php?page=$2 [L]
Either of those work.
This a great plugin and I think many would find it useful. This type of function should be part of Moodle's core code in my opinion.
Thanks for all of your help!
Darrel