Recent Topics

Need to Preverve tempskin=xx through blog_home_link() et. al

Started by on Feb 09, 2012 – Contents updated: Feb 09, 2012

Feb 09, 2012 08:19    

I have a blog that runs with skin A. However, I also call the blog from other apps in an iframe, and use myblog.php?tempskin=B, to have a skin that works with the iframe.

Problem is, I generate HOME and ARCHIVE links with blog_home_link() and $Blog->disp('arcdirurl','raw'), and they DON'T PRESERVE THE parameter string "tempskin=B";

Consequences; as soon as I click either the HOME link or the ARCHIVE link, the blog reverts to its defined skin.

Any ideas?

Feb 09, 2012 15:58

Try the [url=http://forums.b2evolution.net/viewtopic.php?t=16500]Skin switcher[/url] plugin. There's no other way to keep "tempskin" param in those links.

You will need to define skin params in myblog.php and index.php

myblog.php

PHP

$_GET['user_skin_1'] = 'alternative-skin';
require $inc_path.'_blog_main.inc.php';

index.php

PHP

$_GET['user_skin_1'] = 'regular-skin';
require $inc_path.'_blog_main.inc.php';

Feb 09, 2012 19:12

- install the plugin I mentioned above
- create a copy of member_news.php and name it e.g. whatsnew.php
- open member_news.php find this string

PHP

require $inc_path.'_blog_main.inc.php';

and replace it with

PHP

// Switch to default skin
$_GET['user_skin_1'] = 'aux_pa';
require $inc_path.'_blog_main.inc.php';

- open whatsnew.php find this string

PHP

require $inc_path.'_blog_main.inc.php';

and replace it with

PHP

// Switch to temp skin
$_GET['user_skin_1'] = 'aux_whatsnew';
require $inc_path.'_blog_main.inc.php';

- make sure you set correct blog ID instead of "user_skin_1" use e.g. user_skin_4 or user_skin_21

Feb 10, 2012 06:44

Alex,

I did exactly what you said, creating a clone of member_news.php and called it "iframe_member_news.php". Installed the Skin Switcher plugin and activated it. Made the code changes above, careful to say $_GET['user_skin_5'] = 'aux_whatsnew'; in the iframe version, and ...='aux_pa' in the member_news.php original.

Strange results: when I entered the URL http://it-blogs.cgaux.org/iframe_member_news.php the browser redirected immediately to just plain "member_news.php", and displayed the default skin.

You can try it yourself.

Also, out of curiosity, there is a commented out statement in both these routines that says # $skin = 'custom'; # You could *force a specific skin here...

What's THAT all about? Didn't work either.

Feb 18, 2012 06:28

Completely forgot about it :)
I'll test it on my local computer tomorrow.

Feb 19, 2012 03:25

You can force a skin, it's true. However you will be redirected to original blog URL anyway. This is what you need to do.

In _skin_switcher.plugin.php find this code

PHP

/**
 * Event handler: Called before a blog gets displayed (in _blog_main.inc.php).
 */
function BeforeBlogDisplay( & $params )
{
    global $Blog$tempskin;

And add the following code below it

PHP

if( strstr($GLOBALS['ReqURI'], 'iframe_member_news.php') )
{   // The blog is called through iframe_member_news.php file
    // Let's temporarily change blog stub file
    $Blog->siteurl 'iframe_member_news.php';
}

Mar 03, 2012 07:19

No, really. Click on the dev02 link above. It's beautiful. Then click on TOP, in the blog, and the skin changes. I just tried it three times.


Form is loading...

powered by b2evolution – This forum is powered by b2evolution CMS, a complete engine for your website.