Welcome to Geeklog, Anonymous Friday, May 24 2024 @ 02:40 am EDT

Geeklog Forums

Where to find the source for Theme tester?


Status: offline

etegration

Forum User
Full Member
Registered: 02/20/02
Posts: 179
I found this page has it but it seems it's being processed and not showing all the source code.
http://www.etegration.com.sg
http://www.itcow.com
http://www.ministryofhosting.com
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany

The code from this story should work.

bye, Dirk

 Quote

Anonymous

Anonymous
which code do you exactly mean? Do i have to edit the lib-common.php file for geeklog version 1.3.6, too? Thx!
 Quote

Nic

Anonymous
Hi,

I am using Geeklog 1.3.8 and I would like to install the Theme Tester Blcok.

I have searched high and low, in the forums, tried installing some code but it all seems to be from 2002 or outdated.

Anyone know how I can install the Theme Tester Block?

Many thanks,

Nic.
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
That story link doesn't seem to work, so I'll post the code I have in my lib-custom.php. I'm not sure who originally wrote it, so if that person would like credit or if they would like me to remove it and instead point to a different page, please let me know.

Text Formatted Code
function phpblock_themetester()
{
    global $PHP_SELF, $HTTP_POST_VARS, $HTTP_GET_VARS, $_TABLES, $_USER, $_CONF;

    $thememode = $HTTP_GET_VARS['thememode'];

    if ($thememode == 'save') {
        $usetheme = $HTTP_GET_VARS['usetheme'];
    } else {
        $usetheme = $HTTP_POST_VARS['usetheme'];
    }

    if ($_USER['uid'] > 1 AND $thememode == 'save' AND !empty($usetheme)) {
        DB_query("UPDATE {$_TABLES['users']} SET theme='$usetheme' WHERE uid = {$_USER['uid']}");
        echo COM_refresh($PHP_SELF);
    }

    $themes = COM_getThemes();
    if (count($themes) == 1) {
        return 'Sorry, there is only one theme installed on this system';
    }
    $retval .= 'Test out available themes by selecting one below:<br>';
    $retval .= '<form action="' . $PHP_SELF . '" method="POST"><select name="usetheme" onChange="this.form.submit()">';
    $retval .= '<option value="">--</option>';
    for ($i = 1; $i <= count($themes); $i++) {
        $retval .= '<option value="' . current($themes);
        if ($usetheme == current($themes)) {
            $retval .= ' selected="SELECTED"';
        }
        $retval .= '">' . current($themes) . '</option>';
        next($themes);
    }

    if ($_USER['uid'] > 1 AND !empty($usetheme)) {
        $args = 'thememode=save&usetheme=' . $usetheme;
        for ($i = 1; $i <= count($HTTP_GET_VARS); $i++) {
            if (key($HTTP_GET_VARS) <> 'thememode' AND key($HTTP_GET_VARS) <> 'usetheme') {
                $args .= '&' . key($HTTP_GET_VARS) . '=' . urlencode(current($HTTP_GET_VARS));
            }
            next($HTTP_GET_VARS);
        }
        $retval .= '</select></form></center><a href="' . $PHP_SELF . '?' . $args . '">Use Permanently</a>';
    } else {
        $retval .= '</select></form></center></a>';
    }
    return $retval;
}
 
 Quote

Nic

Anonymous
happy
Thank you, it works!! Big Grin
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by Turias: I'm not sure who originally wrote it, so if that person would like credit or if they would like me to remove it and instead point to a different page, please let me know.

The original theme tester was written by Tony (see this post). I think that's the one you have there.

If you see a version that tests for a variety of browsers - that was written by Squatty.

All the others that are floating around are merely variations of these two, AFAIK. The one we currently have of geeklog.net is also a variation of Squatty's version.

bye, Dirk
 Quote

Status: offline

daynah

Forum User
Newbie
Registered: 07/03/02
Posts: 9
Thanks for the post Turias! I've been looking all over for the theme tester block.

The one on this page had an error or two.
http://php-princess.net
 Quote

Status: offline

young_dfler

Forum User
Newbie
Registered: 08/23/06
Posts: 3
Quote by Turias: That story link doesn't seem to work, so I'll post the code I have in my lib-custom.php. I'm not sure who originally wrote it, so if that person would like credit or if they would like me to remove it and instead point to a different page, please let me know.

Text Formatted Code
function phpblock_themetester()
{
    global $PHP_SELF, $HTTP_POST_VARS, $HTTP_GET_VARS, $_TABLES, $_USER, $_CONF;

    $thememode = $HTTP_GET_VARS['thememode'];

    if ($thememode == 'save') {
        $usetheme = $HTTP_GET_VARS['usetheme'];
    } else {
        $usetheme = $HTTP_POST_VARS['usetheme'];
    }

    if ($_USER['uid'] > 1 AND $thememode == 'save' AND !empty($usetheme)) {
        DB_query("UPDATE {$_TABLES['users']} SET theme='$usetheme' WHERE uid = {$_USER['uid']}");
        echo COM_refresh($PHP_SELF);
    }

    $themes = COM_getThemes();
    if (count($themes) == 1) {
        return 'Sorry, there is only one theme installed on this system';
    }
    $retval .= 'Test out available themes by selecting one below:<br>';
    $retval .= '<form action="' . $PHP_SELF . '" method="POST"><select name="usetheme" onChange="this.form.submit()">';
    $retval .= '<option value="">--</option>';
    for ($i = 1; $i <= count($themes); $i++) {
        $retval .= '<option value="' . current($themes);
        if ($usetheme == current($themes)) {
            $retval .= ' selected="SELECTED"';
        }
        $retval .= '">' . current($themes) . '</option>';
        next($themes);
    }

    if ($_USER['uid'] > 1 AND !empty($usetheme)) {
        $args = 'thememode=save&usetheme=' . $usetheme;
        for ($i = 1; $i <= count($HTTP_GET_VARS); $i++) {
            if (key($HTTP_GET_VARS) <> 'thememode' AND key($HTTP_GET_VARS) <> 'usetheme') {
                $args .= '&' . key($HTTP_GET_VARS) . '=' . urlencode(current($HTTP_GET_VARS));
            }
            next($HTTP_GET_VARS);
        }
        $retval .= '</select></form></center><a href="' . $PHP_SELF . '?' . $args . '">Use Permanently</a>';
    } else {
        $retval .= '</select></form></center></a>';
    }
    return $retval;
}

 


Where do we enter this code?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by young_dfler: Where do we enter this code?

Into your lib-custom.php

Also see What are the different block types for?

bye, Dirk
 Quote

young_dfler

Anonymous
Quote by Dirk:
Quote by young_dfler: Where do we enter this code?

Into your lib-custom.php

Also see What are the different block types for?

bye, Dirk


I am still having troubles. I tried putting the content above into a new block's content, however when I paste the script, all that comes out is the same code. Help.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
You may want to actually read what I wrote above ... The code is supposed to go into your lib-custom.php, not into the block.

byem Dirk
 Quote

young_dfler

Anonymous
Quote by Dirk: You may want to actually read what I wrote above ... The code is supposed to go into your lib-custom.php, not into the block.

byem Dirk


Where is the lib-custom.php?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
/path/to/geeklog/system/lib-custom.php

bye, Dirk
 Quote

young_dfler

Anonymous
Quote by Dirk: /path/to/geeklog/system/lib-custom.php

bye, Dirk


Can somone please put a detailed step to step. I have no idea what this is. It makes me not want to use Geeklog. HELOP
 Quote

Status: offline

young_dfler

Forum User
Newbie
Registered: 08/23/06
Posts: 3
I still don't understand this whole block thing. If someone can please help. I am a noob. PLease help.
 Quote

All times are EDT. The time is now 02:40 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content