TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,022
  • Total Topics: 21,332
  • Online today: 473
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 261
  • Total: 261

Making Static Pages Mod work with TinyPortal

Started by gelsbern, August 24, 2005, 06:13:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gelsbern

For months I have been trying to figure out how to make the Static pages look like they were actually part of the site. ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, I tried a couple of methods to get it to include the sidebars but none of them worked. ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, Finally tonight, I think I woke the neighbors. ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, This is a multi-step process so if you are uncomfortable with editing your php files, make sure you back them up first so that you can go back to at least the original functionality. ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  I would also recommend reading the instructions through at least once before attempting this to make sure you have at least run through ALL The steps in your head. ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, 

You can see it on one of my websites. ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, http://www.gobclansite.comÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  Once there, over on the left side, click the link that says TMG Settings.

Anyway, here we go....

The first change is to ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  Sources/TPortal.php

To get the static pages mod to at least allow the left and right bars, find the following code.


// check if the blocks are hidden in ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, forum. Setting of hide whole bar overrides.
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  if(!in_array($context['TPortal']['action'], array('tportal','tpadmin','tpmod',''))){
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  if($context['TPortal']['hide_leftbar_forum'])
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  $context['TPortal']['leftbar']=0;
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, if($context['TPortal']['hide_rightbar_forum'])
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  $context['TPortal']['rightbar']=0;
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  }


and make a simple change. ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, You want to place the action name 'static' into the array. ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, Your code should look like this.


// check if the blocks are hidden in ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, forum. Setting of hide whole bar overrides.
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  if(!in_array($context['TPortal']['action'], array('tportal','tpadmin','tpmod','static',''))){
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  if($context['TPortal']['hide_leftbar_forum'])
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  $context['TPortal']['leftbar']=0;
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, if($context['TPortal']['hide_rightbar_forum'])
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  $context['TPortal']['rightbar']=0;
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  }



We do this so that if by chance you have turn left/right bars off for the forum, it will put the bars in for the static pages.ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, 
Actually if you have the bars turn off for the forum, this change actually will work for any action= page that doesn't display the bars
Just add the action name into the list and presto, side bars.

Now if you save your file and load your static page, you will see that indeed we do have the left and right bars, but to me it still looks out of place. ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, So to get it closer to looking like it belongs, the next file you want to edit is Themes/$your_theme_name/ _StaticPageMod.template.php.ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  If it is not in the directory of the theme you are using, copy it from the default theme directory.

Look for
$local_staticContent = $modSettings[$local_settingvar];

ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, // Display the content



Now between those 2 lines, (after the $local_staticContent line and before the //Display the content add this code


ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  $local_get_title = "staticpage_Title" . $_REQUEST['staticpage'];
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, $local_title = $modSettings[$local_get_title];


ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, echo '<table cellspacing="0" cellpadding="0" width="100%" style="margin-bottom: 4px;" border="0" class="tborder"> <tr> <td width="100%"><div>

ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, <div class="titlebg" style="padding: 6px;"><b>';
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  echo ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, $local_title;
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, echo '</b></div><div style="padding: 8px; padding-top: 0px;" class="windowbg2">';



So your code now looks like this


$local_staticContent = $modSettings[$local_settingvar];

$local_get_title = "staticpage_Title" . $_REQUEST['staticpage'];
$local_title = $modSettings[$local_get_title];


ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, echo '<table cellspacing="0" cellpadding="0" width="100%" style="margin-bottom: 4px;" border="0" class="tborder"> <tr> <td width="100%"><div>

ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  <div class="titlebg" style="padding: 6px;">';
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  echo ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, $local_title;
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, echo '</b></div><div style="padding: 8px; padding-top: 0px;" class="windowbg2">';



ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, // Display the content


ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, Notice also that we now get the title and place it in the proper spot.

Next we need to add one more line to _StaticPageMod.template.php ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, which you should still have open because I haven't said you can save it yet. ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ;D

At the bottom of the file

right before the final bracket and ?> you want to make it add this line


echo '</div></div><div class="windowbg" style="padding: 6px;"></div></td></tr></table>';



So now the very end of your file should look like


echo '</div></div><div class="windowbg" style="padding: 6px;"></div></td></tr></table>';
}
?>


Now you can save your file and reload one of your static pages and you will see that it comes close to fitting in with the rest of your site.

I really hope I explained this well enough for everybody to understand it. ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, 
If you have any questions, leave a message for me, here on the forum, or ask your question as a reply. ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  So far I have done this with the ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, black22_tp and the apollo_tp and I was able to just copy the files, which if you don't want edit yours or if you want to review them I have attached.

I just hope I have explained this well enough. ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, 


Bloc if you want to move this somewhere else, or if you can make it more readable, please feel free to do so.



[attachment deleted by admin]

Nokonium

I'm errr somewhat confused, how is the Static Page Mod different to using the TP 'Content' menu and articles?

gelsbern

Because, and I may be wrong on this, but articles are strictly text with some of the board code available, where as the static pages are html or php, which means if you had a site with a bunch of pages you wanted to include on your current site, you just copy and paste all the html or code in, make a quick menu and you are all set.  I don't think you can put HTML into the articles, but like I said, I might be wrong.

Nokonium

You can put HTML into articles and you can link to other sites. Tables work well and you can use actions already defined in SMF i.e. you can use the link addresses used by the menu or buttons etc and they will replace the article. You can also incorporate images, even a table with image slices. Unfortunately I cannot give you a live example at the moment, other than a table with image slices, as I screwed up the database of my second test site and couldn't re-use my backup with all my articles on it.

You can then use the style.css for the theme, if you need new styles you add them to the existing stylesheet.

If you want PHP you can use a PHP block, my main test site does this with a center block.

gelsbern

#4
Well that's cool.ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  When I edit the articles I get a WYSIWYG screen and every time I tried to add in articles and such it didn't come out right, so I downloaded the static pages mod and it almost did what I wanted all I had to do was make a couple modifications.ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, 

Oh and I tested putting html into an article in a category and you can see it here, I think.ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, 
http://www.nullstorm.com/index.php?cat=3

So rather than retyping the entire html page as an article, it is SO much easier to just put it in a static page.

You really don't have to use it, I just put this here for those who ARE looking for a solution.

Bjørn

The WYSIWYG editor used in Tinyportal is not good, so it WILL be replaced.

SundayNiagara

#6
$64,000 question:
     Will this work with the helios-multi-tp theme?
Mark

gelsbern

Quote from: SundayNiagara on August 24, 2005, 12:22:13 PM
$64,000 question:
ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ,  ÃÆ'ââ,¬Å¡Ãƒâ€šÃ, Will this work with the helios-multi-tp theme?
Mark
]

Well because you asked, I installed the helios multi tp theme on one of my sites, site, copied the _StaticPageMod.template.php to the theme directory and it works just fine. 

SundayNiagara

The two files you have available for downloading, are they already modified?
Mark

gelsbern

Yes they are already modified.  I did it both ways because a pet peeve of mine is someone gives files without saying what they really do, or they give this big long set of instructions without providing the files, so I did it both ways. 

This website is proudly hosted on Crocweb Cloud Website Hosting.