Static Pages icon

Static Pages

Moodle plugin which displays static information pages which exist outside any course, imprint or faq pages for example, complete with Moodle navigation and theme
Price option: Free

Supports Moodle 2.4-5.2 See all versions
Latest release: 2 weeks ago
Installations: 4885
Downloads (last 90 days): 1472

Frankenstyle name: local_staticpage
Local plugins

Comments

Comments are no longer open for new posts. Existing comments remain available to read.

Hello all,
I don't have a single clue where to post a new question, I'll drop it here I guess.
We have installed the newest versions of Xaamp and Moodle on a Windows XP pro machine to set up everything locally before we upload to a server. We get as far as setting up the admin stuff, then go to supposed localhost login page to Moodle, but it does not load, just get the page not found error message. The control panel for Xaamp is open with appropriate services running. Even if we try to manually open a Moodle PHP page from the Moodle folder in the Xaamp/htdocs/Moodle directory , nothing happens. Localhosts file is not blocking anything. No firewall is running. Same results in 3 browsers
Anybody have any ideas on this?
We are lost

I have some solutions that I hope other users of this plugin will find useful.
Regarding the apache rewrite issue. I discovered that I needed to remove the leading slash before static/ in the RewriteRule. So I now have this:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^static/(.*)\.html$ /local/staticpage/view.php?page=$1&%{QUERY_STRING} [L]

You can also use:RewriteRule ^(.*)static/(.*)\.html$ $1/local/staticpage/view.php?page=$2 [L]
Now the clean urls work.
Also, I wanted to add images to my static pages. I put images in /moodledata/staticpage/images. When I put the relative path or the absolute path to the image in the static page html, the image can't be found. I think because this is in moodledata. So I moved my staticpage folder to the Moode http root and reconfigured the plugin to use that location. However when the page is rendered for the clean url the path to the image is getting caught by the RewriteRule. So I created a neighboring folder /staticpage_images and put my graphics there. Then in my static page html my img code is:
logo
If your handy with html I think you can get pretty dynamic with adding static content to Moodle.
Darrel
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
Darrel,
great to hear that the plugin finally works for you smile
Alex
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
Hmm, that's strange. The static page should use the same theme as your normal Moodle does.
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
Sorry Alex but it's not looking correct to me.
Here are two screen shots. One of my home page, and one of the static page.
boostrap.png?w=AABTAqoU8_uohejpBgeBe7rYYSD8fFLafRc2uPlmVa1lIw
static.png?w=AAB4kAmUbE38CjwOAPtPNGpnJwzGUeDU_WzEsrCi8GPbmA
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
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
Alex,
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
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. smile
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
Dear 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 smile
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
After much trial and error I’ve determined that I have three issues with the plugin.
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
Hi all,
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
Alexander,
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.
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