Static Page Mod

Started by –Michael, May 20, 2005, 04:09:34 AM

Previous topic - Next topic

–Michael

Link to Mod

Purpose:
Adding up to 10 static pages within SMF. For details, see Static Page Mod Site
My SMF Mod: Static Page Mod

SaniOKh

Yeah, I think this can come in handy for making a "board rules" page or something.
Great work ;).

For Russian and French users: open the ZIP file with 7zip, then EDIT the staticpagemod.xml file:
after this: <file name="$languagedir/Modifications.german.php">
<operation>
<search position="after"><![CDATA[?>]]></search>
<add><![CDATA[

$txt['staticpage_Title'] = 'Static Page Mod - Optionen';
$txt['staticpage_Content1'] = 'Inhalt fьr Seite 1<div class="smalltext">(HTML ist erlaubt)</div>';
$txt['staticpage_Content2'] = 'Inhalt fьr Seite 2<div class="smalltext">(HTML ist erlaubt)</div>';
$txt['staticpage_Content3'] = 'Inhalt fьr Seite 3<div class="smalltext">(HTML ist erlaubt)</div>';
$txt['staticpage_Content4'] = 'Inhalt fьr Seite 4<div class="smalltext">(HTML ist erlaubt)</div>';
$txt['staticpage_Content5'] = 'Inhalt fьr Seite 5<div class="smalltext">(HTML ist erlaubt)</div>';

]]></add>
</operation>
</file>

add this (copy/paste ;) ):
<file name="$languagedir/Modifications.french.php">
<operation>
<search position="after"><![CDATA[?>]]></search>
<add><![CDATA[

$txt['staticpage_Title'] = 'Static Page Mod - Options';
$txt['staticpage_Content1'] = 'Contenu de la page #1<div class="smalltext">(HTML est permis)</div>';
$txt['staticpage_Content2'] = 'Contenu de la page #2<div class="smalltext">(HTML est permis)</div>';
$txt['staticpage_Content3'] = 'Contenu de la page #3<div class="smalltext">(HTML est permis)</div>';
$txt['staticpage_Content4'] = 'Contenu de la page #4<div class="smalltext">(HTML est permis)</div>';
$txt['staticpage_Content5'] = 'Contenu de la page #5<div class="smalltext">(HTML est permis)</div>';

]]></add>
</operation>
</file>

<file name="$languagedir/Modifications.russian.php">
<operation>
<search position="after"><![CDATA[?>]]></search>
<add><![CDATA[

$txt['staticpage_Title'] = 'Static Page Mod - Опции';
$txt['staticpage_Content1'] = 'Содержание страницы #1<div class="smalltext">(тэги HTML разрешены)</div>';
$txt['staticpage_Content2'] = 'Содержание страницы #2<div class="smalltext">(тэги HTML разрешены)</div>';
$txt['staticpage_Content3'] = 'Содержание страницы #3<div class="smalltext">(тэги HTML разрешены)</div>';
$txt['staticpage_Content4'] = 'Содержание страницы #4<div class="smalltext">(тэги HTML разрешены)</div>';
$txt['staticpage_Content5'] = 'Содержание страницы #5<div class="smalltext">(тэги HTML разрешены)</div>';

]]></add>
</operation>
</file>


( I translate MODs I use, I always forget this may come in handy to other people...)

codenaught

Nice mod.

I could see it coming in handy for making a page in the forum with information like forun rules or anything really. Nice job.
Dev Consultant
Former SMF Doc Coordinator

Norbert

Thx. It works fine for me. ---> Impressum

–Michael

Nice to see that you like this mod, guys  :)

@SaniOKh:
Quote from: SaniOKh on May 20, 2005, 02:11:40 PM
For Russian and French users

I only can see something French here, but no Russian  ;)

I am going to add additional languages to future versions of this mod.
Please just let me know your translations.

Michael
My SMF Mod: Static Page Mod

John Slater

#5
When i go to forum features to add HTML i dont see the text boxes to add the HTML :-s

Ignore that, i should learn to read :-)

–Michael

I've received an e-mail in German, where it is asked how to use more than 5 static pages with this mod.


1. File 'staticpagemod.xml'

Search for:
$txt['staticpage_Content5'] = 'Page content #5<div class="smalltext">(HTML is allowed)</div>';
Add after:

$txt['staticpage_Content6'] = 'Page content #6<div class="smalltext">(HTML is allowed)</div>';
$txt['staticpage_Content7'] = 'Page content #7<div class="smalltext">(HTML is allowed)</div>';
$txt['staticpage_Content8'] = 'Page content #8<div class="smalltext">(HTML is allowed)</div>';
$txt['staticpage_Content9'] = 'Page content #9<div class="smalltext">(HTML is allowed)</div>';
$txt['staticpage_Content10'] = 'Page content #10<div class="smalltext">(HTML is allowed)</div>';


Search for:
$txt['staticpage_Content5'] = 'Inhalt für Seite 5<div class="smalltext">(HTML ist erlaubt)</div>';

Add after:

$txt['staticpage_Content6'] = 'Inhalt für Seite 6<div class="smalltext">(HTML ist erlaubt)</div>';
$txt['staticpage_Content7'] = 'Inhalt für Seite 7<div class="smalltext">(HTML ist erlaubt)</div>';
$txt['staticpage_Content8'] = 'Inhalt für Seite 8<div class="smalltext">(HTML ist erlaubt)</div>';
$txt['staticpage_Content9'] = 'Inhalt für Seite 9<div class="smalltext">(HTML ist erlaubt)</div>';
$txt['staticpage_Content10'] = 'Inhalt für Seite 10<div class="smalltext">(HTML ist erlaubt)</div>';


Search for:
array('textarea', 'staticpage_Content5', array('6', '50')),

Add after:
Quote
         array('rule'),
            array('textarea', 'staticpage_Content6', array('6', '50')),
         array('rule'),
            array('textarea', 'staticpage_Content7', array('6', '50')),
         array('rule'),
            array('textarea', 'staticpage_Content8', array('6', '50')),
         array('rule'),
            array('textarea', 'staticpage_Content9', array('6', '50')),
         array('rule'),
            array('textarea', 'staticpage_Content10', array('6', '50')),



2. File 'staticpagemod_mysqlsettings_add.php'

Search for:
'staticpage_Content5' => '',

Add after:

'staticpage_Content6' => '',
'staticpage_Content7' => '',
'staticpage_Content8' => '',
'staticpage_Content9' => '',
'staticpage_Content10' => '',


2. File 'staticpagemod_mysqlsettings_remove.php'

Search for:
'staticpage_Content5',

Add after:

'staticpage_Content6',
'staticpage_Content7',
'staticpage_Content8',
'staticpage_Content9',
'staticpage_Content10',
My SMF Mod: Static Page Mod

sdl

#7
I am definitely missing something.  Both mods installed fine. I can see the options, and I've edited/created/saved a static page that I want to use. Now comes the not-so-clear (to me) part.

You wrote:

To call your static pages, use the following URL format:

http://www.yoursite.com/forum/index.php?action=static&staticpage=X

These static pages are displayed in the main section of SMF -- between header and footer:[/i]

I'm not so sure I understand static page. Do they only work when you call them out from a browser address bar, or is there a file (or files) I can edit so that the static page(s) appear normally in a main forum page?




–Michael

#8
sdl,

I've used separate HTML pages to display static content such as forum rules, 'about this forum', etc. The main disadvantage of using separate HTML files for this purpose is, that these are not integrated in SMF.

Therefore I needed a solution, so contents like 'forum rules' should be displayed in SMF and not somewhere else. "In SMF" means, that the content should be displayed in the main section of SMF. For example, if you click on "Register", "Login" or "Search", a page comes up which is well integrated between header and footer. In a similar way I wanted to integrate my static pages.

This is what the Static Page Mod provides.
You edit your static pages in "Forum Configuration / Edit Features & Options / Static Page Mod Options. There you have 5 text boxes. You can enter / paste HTML there, this HTML is the content for your static pages.

It's recommended to provide a button, e.g. "Forum Rules". Add the URL " http://www.yoursite.com/forum/index.php?action=static&staticpage=1" in the anchor. When a user clicks the button, the static page #1 will be displayed. It just gets the HTML which you've entered in the Forum Config and renders the page to be displayed.

If you'd like to know details about how this is done, just take a look at the mod files or ask here.

Michael
My SMF Mod: Static Page Mod

forumite

Michael

Thanks for the mod - works great.

One question - if I want to increase the number of static pages after installing the mod, I can see the changes required to:

Sources/ModSettings.php
Themes/Default/Languages/Modifications.english.php

What else needs to be changed?

TIA

dtm.exe

Great mod :).  I'm using it on the chat page of my forums.

http://www.oi-forums.com/index.php?action=static&staticpage=1

Quote from: rvforumite on June 02, 2005, 08:21:00 AM
Michael

Thanks for the mod - works great.

One question - if I want to increase the number of static pages after installing the mod, I can see the changes required to:

Sources/ModSettings.php
Themes/Default/Languages/Modifications.english.php

What else needs to be changed?

TIA

I would also like to know this.

-Dan The Man

Xarcell

DUDE!

This is perfect, static pages is a must have for my websites. Thanx for helping my dreams come true.

Sincerly,

-Xarcell

Xarcell

I'm using the classic theme for my smf-site. I got the link to view my static pages, but how can I add it to my menu buttons at the top? When I just try to slide in html code link, I get a parse error. I know html/css, but I don't know any php.

Any suggestions?

-Xarcell

forumite

#13
Xarcell

In Themes/Default/index.template.php:

After:
// How about the [search] button?
if ($context['allow_search'])
echo '
<a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" style="margin: 2px 0;" border="0" />' : $txt[182]), '</a>', $context['menu_separator'];



Insert (on new line):
// How about the [your_button] button?

echo '
<a href="http://www.yourforum.com/forum/index.php?action=static&staticpage=1">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/your_button.gif" alt="' . $txt[801] . '" style="margin: 2px 0;" border="0" />' : $txt[801]), '</a>', $context['menu_separator'];



Of course, the your_button.gif image needs to be in your Themes/Default/Images directory. You can create new SMF-style buttons here.

–Michael

How to increase the number of static pages *after* installing the mod:

Possibility #1: Re-install Static Page Mod

  • Go to "Forum Configuration / Edit Features & Options / Static Page Mod Options" and copy all your HTML sourcecode into a textfile - this is for backup purposes since these will be deleted in the following steps.
  • Uninstall the static page mod
  • Perform the changes on the Static Page Mod, see reply #6 in this thread
  • Install the modified Static Page Mod

Possibility #2: Edit files directly without re-install

You need to modify the following files:
- $languagedir/Modifications.english.php
- $languagedir/Modifications.german.php (if applicable)
- $sourcedir/ModSettings.php
See reply #6 in this thread for details what needs to be added, in addition see staticpagemod.xml which comes with the mod.

In addition, you need to add values to the setting table in MySQL. To do this, modify the staticpagemod_mysqlsettings_add.php which comes with the mod and add
      array('rule'),
            array('textarea', 'staticpage_Content6', array('6', '50')),
  (and so on...)

See reply #6 in this thread for details.

Then, copy the staticpagemod_mysqlsettings_add.php into the board dir and open the file with your browser, e.g. http://yoursite.com/smf/staticpagemod_mysqlsettings_add.php.



I suggest to use possibility #1, since the mod can be uninstalled more easy.
My SMF Mod: Static Page Mod

–Michael

#15
Thanks for your feedback so far.

I have received the following PM:
Quote
(...)
How about making a mod that shows newsfeed (using rss or whatever) displayed on a static page?
That would also be a must have if i was avialable. You could alter your static mod and use the smf rss system to make a new newsfeed mod.

Well, I think about the possibility to support – in addition to HTML – PHP code in the Static Page Mod options.
In this way, we would be very flexible and could also display stuff like rss or whatever.
Anyway, I am not going to add "special services" such like rss to this mod, but if PHP code can be used, everyone can use the power of it (and could for example use SSI).

Michael
My SMF Mod: Static Page Mod

forumite

Thanks Michael. I figured that option 1 would be the best choice.

Xarcell

Thanx, I got it to work! (the button that is)

Thanx again,

-Xarcell

Xarcell

I think option 1 would be better too. We could do more with it as far as other things go if the idea comes along.

-Xarcell

dtm.exe

Just to let other people know, the Static Page Mod DOES NOT work with SMF 1.0.4.

-Dan The Man

Advertisement: