Page 1 of 1

Style changing & different portal layout per style?

PostPosted: Tue Feb 06, 2007 4:33 pm
Author: tekguru
Your phpBB Version: 2.0.
phpBB Type: Integramod 141
MODs: Yes
Your knowledge: Beginner
Board URL: http://www.4winmobile.com/portal.php

PHP Version:
MySQL Version:


What was done before the problem appeared?
N/A


What was done to try to solve the problem?
N/A



De.scription and Message

Okay here we go.....

1) In IM 1.40 the Style change block was patched out as it was a security issue. Has that issue now been fixed in 1.41 as the style change block is back?

2) Prior to the style block patches in IM 1.40 one could pass the s=XX parameter to a page to change the style, this was disabled by the patch. It seems that this functionality is still missing in IM 1.41.

What I want to do is to add a link in QBAR which a user can click on to change from one theme to another. Is this possible?

3) Is it possible to change the style automatically based on data read back from a web browser, that is of the user is using a mobile device then to get the forum to auto-select a different style?

4) The layout file used by the portal, is there any way of tying this to a theme, so that if a user does get the theme changed (manually or automatically) then the portal layout can change.

Hope some kind soul can help with these questions!

PostPosted: Sun Mar 04, 2007 4:35 pm
Author: tekguru
Did anyone ever have any thoughts on this problem?

Re: Style changing & different portal layout per style?

PostPosted: Wed Mar 07, 2007 9:15 pm
Author: Frost
Okay here we go.....

1) In IM 1.40 the Style change block was patched out as it was a security issue. Has that issue now been fixed in 1.41 as the style change block is back?

2) Prior to the style block patches in IM 1.40 one could pass the s=XX parameter to a page to change the style, this was disabled by the patch. It seems that this functionality is still missing in IM 1.41.

What I want to do is to add a link in QBAR which a user can click on to change from one theme to another. Is this possible?



I believe it was patched, if not I'm sure it wouldn't be included, but that's a question for one of the devs

As far as the question about the qmenu, I'm sure it's possible you would just have to find and copy the link from the block into the menu. I'll have a look on the test board and get back with you on this.

3) Is it possible to change the style automatically based on data read back from a web browser, that is of the user is using a mobile device then to get the forum to auto-select a different style?

4) The layout file used by the portal, is there any way of tying this to a theme, so that if a user does get the theme changed (manually or automatically) then the portal layout can change.

Hope some kind soul can help with these questions!


Hmm, very good question lol
Like I always say, anything is possible. I'm not so sure a mobile phone could handle an integramod site no matter what theme/layout you used without losing most if not all of it's functionality. But, all you would have to do is use php to read the environmental data and use "if" so and so, output so and so.

I wonder if you could use the "light" version already included to help with this...

We will need some information, but I think it would be possible, we could combine the mod I saw floating around that changes the theme based on the forum/layout, then tweak it for this. Do you know what the browser of a mobile phone uses vs. a web browser?

Any more information you could gather would help. Im going to go set up a new site just for this because you seem to be a pioneer in IntegraMOD for mobile lol

Edit:
After thinking about this more, I have come to the conclusion that a mobile phone would stand no chance of rendering an integramod site properly. I did some testing with a small amount of advanced html and some java.script and it destroyed the page load of my phone. I think if there is a certain thing you are wanting your users to be able to see instead of the whole site it would be possible. Say you wanted them to be able to read new posts or perhaps post a reply, you could use a seperate portal page with a very basic topics display and a small quick reply. Also you would have to remove any graphics/animation so it wouldn't take 30 minutes to load. As it is now 85% or so people pay for internet service on their phone so load time is important.

So, what exactly are you wanting the users to see if they visit with a mobile phone?

Re: Style changing & different portal layout per style?

PostPosted: Wed Mar 07, 2007 11:12 pm
Author: Helter
this is just an educated guess, as I have not had much to do with Cracker Tracker, but I believe that the vulnerability of the style being passed as a url is protected by CT, which is prob why we still have the style select block. If you added it to the ignore vars it should work, but you would expose your site to that vulnerability

PostPosted: Thu Mar 08, 2007 10:51 am
Author: tekguru
Nope its not CT as the style change paramters stopped working with the prior security update.

Good is it so difficult to get things done at times.

All I want ideally to do is detect the browser string as a Pocket PC or PC and change the theme accordingly.

PostPosted: Thu Mar 08, 2007 5:39 pm
Author: Helter
The original style select block was re-added AFTER CT was added

PostPosted: Fri Mar 09, 2007 7:11 am
Author: tekguru
Right, so if that block is considered 'safe' as it does work, why should the style change via parameter now no longer work, no CT errors are generated?

Re: Style changing & different portal layout per style?

PostPosted: Fri Mar 09, 2007 7:33 am
Author: tekguru
Now one of my Admins did come up with the following but i've no ideas if it will work or how to integrate it:

Code: Select all
<php>sql_query($sql)) && ($row = $db->sql_fetchrow($result)) )                 {                     $style = $row['themes_id'];                 }                 else                  {                     message_die(GENERAL_ERROR, &quot;Could not find style name $style.&quotWink;                 }             }         }         else         {             $style = $board_config['default_style'];         }       // End of Conitional Selector for $style             //         // Style details         //         $sql = &quot;SELECT t.themes_id, tdi.*                 FROM ( &quot; . THEMES_TABLE . &quot;  t                 LEFT JOIN &quot; . THEMES_SELECT_INFO_TABLE . &quot; tdi ON t.themes_id = tdi.themes_id )                 WHERE t.themes_id = &quot; . $style;         if( ($result = $db->sql_query($sql)) && ($row = $db->sql_fetchrow($result)) )         {             $style_author = $row['style_author'];             $style_version = $row['style_version'];             $style_website = $row['style_website'];             //$style_views = ( !empty($row['style_views']) ) ? $row['style_views'] : '0 ';             $style_dlurl = $row['style_dlurl'];             $style_dls = ( !empty($row['style_dls']) ) ? $row['style_dls'] : '0';             $style_loaclurl = $row['style_loaclurl'];             $style_ludls = $row['style_ludls'];         }         else         {         //    $s tyle_views = '&nbsp';         //    $style_dls = '&nbsp';         }         if(!empty($style_website))         {              $style_author = '<a>' . $style_author . '<a>';         }         if ($style_loaclurl)         {             if  ($style_loaclurl == &quot;included&quotWink             {                 $select_style_localu rl = $lang['Style_select_loaclurl_included'];             }             els e             {                 $select_style_localurl = &quot;<a>&quot;.$lang['Style_select_loaclurl'].&quot; </a>&quot;;                 }         }                 //         // Update the view counter         //         //$sql = &quot;UPDATE &quot; . THEMES_SELECT_INFO_TABLE . &quot;         //    SET style_views = style_views + 1         //    WHERE themes_id = $style&quot;;         //if( !$db->sql_query($sql) )         //{         //    message_die(GENERAL_ERROR, &quot;Could not update style views.&quot;, '', __LINE__, __FILE__, $sql);         //}           //if( $db->sql_affectedrows() == 0 )         //{             //             // Update the view counter             //         //    $sql = &quot;INSERT INTO &quot; . THEMES_SELECT_INFO_TABLE . &quot; (themes_id, style_views)         //        VALUES ($style, 1)&quot;;         //    if( !$db->sql_query($sql) )         //    {         //        message_die(GENERAL_ERROR, &quot;Could not insert style views.&quot;, '', __LINE__, __FILE__, $sql);         //    }         //}                 //         // Styles list         //         $sql = &quot;SELECT themes_id, style_name             FROM &quot; . THEMES_TABLE . &quot;             ORDER BY style_name&quot;;                 if(!$result = $db->sql_query($sql))         {             message_die(GENERAL_ERROR, &quot;Could not get list of styles!&quot;, &quot;&quot;, __LINE__, __FILE__, $sql);         }                 $select_theme = &quot;<select>n&quot;;         while( $row = $db->sql_fetchrow($result) )         {             $selected = ($row['themes_id'] == $style) ? &quot; selected=&quot;selected&quot;&quot; : &quot;&quot;;             $select_theme .= &quot;<option>&quot; . $row['style_name'] . &quot;</option>&quot;;         }         $select_theme .= &quot;</select>n&quot;;         $template->assign_vars(array(              'L_STYLE_SITENAME' => $board_config['sitename'],             'S_SELECT_STYLE' => $select_theme)         );         //$template->assign_vars(array('S_SE LECT_STYLE' => $select_theme));           if ( $style_author )         {             $template->assign_block_vars('switch_style_aut hor', array());             $template->assign_vars(array('L_STYLE_AUTHOR' => $lang['Style_select_author'] . $style_author));         }         if ( $style_dlurl )         {             $template->assign_block_vars('switch_style_dlu rl', array());             $template->assign_vars(array('L_STYLE_DLURL' => &quot;<a>&quot;.$lang['Style_select_dlurl'].&quot;</a>: &quot;.$style_dls));         }         if ( $style_loaclurl )         {             $template->assign_block_vars('switch_style_loa clurl', array());             $template->assign_vars(array('L_STYLE_LOCALURL' => $select_style_localurl));         }         if ( $style_version )         {             $template->assign_block_vars('switch_style_ver sion', array());             $template->assign_vars(array('L_STYLE_VERSION' => $lang['Style_select_version'] . $style_version));         }         if ( $style_views )         {             $template->assign_block_vars('switch_style_vie ws', array());             $template->assign_vars(array('L_STYLE_VIEWINGS' => $lang['Style_select_viewings'] . $style_views));         }         // END Style Select MOD     }}  auto_style_select_block_func();?>

Re: Style changing & different portal layout per style?

PostPosted: Sun Mar 11, 2007 1:58 am
Author: Frost
Hey I just stumbled across this maybe it will help

Mobile Online phpBB 1.6



Features:

* View posts
* Support WAP, xHTML and HTML interfaces
* Who's online?
* Login/logout
* Flood control
* New posts/replies
* Private messages
* Private forums
* Automatic distinguish user interface*
* Append mobile type when new posts/replies*
* Register/update profile through mobile*
* View posts since last visit
* View your posts
* View unanswered posts
* Support PHP-Nuke*
* BBcode
* Smilies
* Add sign + before forums and topics with new posts/replies
* Add "index2.php" to display all topics from various categories and forums

The feature marked with a star (*) has an enable/disable option, the default value is disable. Please refer to package "readme.html" file installation and configuration section for detail.


http://www.mobileonlinestyle.com/

PostPosted: Sun Mar 11, 2007 2:05 am
Author: tekguru
Looks interesting, we've already develped our own mobile theme but if the auto-change code is borrowable maybe it will be useful <img>

Re: Style changing & different portal layout per style?

PostPosted: Mon Mar 12, 2007 1:01 am
Author: Frost
Don't know if you're still messing with this, but I found another one lol

phpBBToGo is a phpBB mod that lets phpBB web sites display phpBB forums, in a mobile web-site friendly format. It's a turnkey solution for transforming phpBB into a highly customizable, mobile web portal. phpBBToGo will allow your phpBB community members to view your phpBB content anytime/anywhere - even without a mobile internet connection!

PostPosted: Mon Mar 12, 2007 12:42 pm
Author: tekguru
We've looked at this in the past, I can't remember why but it had problems with IM, something was not compatible.

So annoying that we have the moble theme working theres just no way to auto change to it!

Re: Style changing & different portal layout per style?

PostPosted: Tue Mar 13, 2007 1:09 am
Author: Frost
Ok, let's take a second to think about it...

First off you'd have to make a special theme/layout designed for the handheld's browser
(This you've already done apparently)

Then that part is done

Now you'll need to use php to control the output of the site based on the browser. Mobile phones use a special header section (for lack of a better phrase) that let's any website know it's a mobile phone so it either output's the site like normal, or tells the phone that it can't read the site. You could find that code and show me and we can tweak it and reverse it or...

We need a dev for integramod to tell us which file(s) control the whole theme system so we can add the php to it. Might be class_template.php or something in includes/

or...

we could use a "switcher" so that it will switch the style automatically.
Pros and Cons...

Pros
This can switch the user to a stylesheet automatically, but it set's a cookie by default and I don't know if phones can use cookies.

This is all done automatically and "behind the scenes"

Cons
Like I stated before, i don't know if phones can handle cookies

Using this method the user would have to click a link to change the stylesheet

Example: Using this method you could add a link in your header to automatically switch between several stylesheets flawlessly and quickly. It even set's a cookie that lasts a year (can be changed) and in the future that user would automatically see the stylesheet he chose last.

Now, I guess you could set up a subdomain like "mobile.yoursite.com" and have that automatically redirect to your site and choose the mobile stylesheet.

There are so many "external" ways to do this but because of my lack of knowledge of what file(s) to change within integramod I cant play with it further.

If I knew all files that dealt with controlling the theme I could prob build you a mod to use.

Anyways below are several links for you to look at to make your little "switches"
Most of these are very simple and only take a few lines of code.

http://www.contrastsweb.com/switcher/v1/

http://www.alistapart.com/stories/phpswitch/

http://alterior.net/archives/000021.php

This all easily takes care of the switch, and that's half the battle, we just need to find a way to make it read if the browser is phone or not...

ps

A little example of code for the subdomian (mobile.yoursite.com) could be like...

Code: Select all
</a>


This was copied from http://www.mikeindustries.com/blog/arch ... e-friendly

And that's about all I can do/think of using without knowing the files we need for integramod integration

PostPosted: Tue Mar 13, 2007 12:22 pm
Author: tekguru
Right, a lot to think on there!

The way we used to have it working was via two options on the top Qbar which allowed users to switch between the Mobile and Full styles. Thinking on it this may be the best way to do it as it offers the uses the option of which way tehy want to use the forum.

The mikeindustries code I've looked at before but IIRC it clashed with the SEO Mod I have in place so is a dead end.

So we just need to work out how to change from style X t style Y via a Qbar link and that shoudl be all is needed.

Cheers for putting the thought into this!

Re: Style changing & different portal layout per style?

PostPosted: Tue Mar 13, 2007 9:07 pm
Author: Frost
Oh, well if that's all you want, that's easy to do

It explains how to do it right here

http://www.alistapart.com/stories/phpswitch/

PostPosted: Wed Mar 14, 2007 12:29 am
Author: tekguru
I think we are on cross purposes here, it's not the CSS style we wish to switch but the theme that has been loaded under IM.

My bad teminology probably....

Re: Style changing & different portal layout per style?

PostPosted: Wed Mar 14, 2007 3:02 am
Author: Frost
Ahh, ok

Well thats a horse of a different color...
That would take a lot more work, if you would have done a different css on the same theme it would have been easy lol

PostPosted: Wed Mar 14, 2007 11:42 am
Author: tekguru
I know hense the problem... <img>