You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 149 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Changing theme by clicking on a link, how? [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
jib_intelli
Captain
Captain


Joined: Jun 10, 2004
Posts: 338

Location: Lucknow, India

PostPosted: Fri Dec 24, 2004 7:56 pm Reply with quoteBack to top

I want users to be able to switch between themes, by clicking a link. For example:

Link 1: On click, site theme=1
Link 2: On click, site theme=2

etc.

How do I do it? Please help me ASAP. I mean I know it is possible, but what should be the structure of the link?

_________________
It is not our abilities which decide what we truly are, it is our choices.

Image
Find all posts by jib_intelliView user's profileSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN Messenger
madman
Support Mod
Support Mod


Joined: Feb 15, 2004
Posts: 806


PostPosted: Sun Dec 26, 2004 9:09 am Reply with quoteBack to top

How to put those links? As a block?
Static link won't work because you need user id to update default theme on database. This an example on how to select theme using block:
Code:
<?php

global $user;
$content = '';

if (is_user($user))
{
  if (!is_array($user))
  {
    $temp = explode(':', $user);
    $userid = intval($temp[0]);
    unset($temp);
  }
  else
  {
    $userid = intval($user[0]);
  }

  $themelist = array();
  $handle=opendir('themes');
  if ($handle)
  {
    while ($file = readdir($handle))
    {
      if (preg_match('/^\.+/', $file)) continue;
      if (!is_dir("themes/$file")) continue;
      $themelist[] = $file;
    }
    closedir($handle);
  }

  for ($i=0, $j=count($themelist); $i<$j; $i++)
  {
    $themename = ucwords(strtolower(str_replace('_', ' ', $themelist[$i])));
    $content .= '&bull; <a href="modules.php?name=Your_Account&amp;op=savetheme&amp;user_id='.$userid.'&amp;theme='.$themelist[$i].'">'.$themename.'</a><br />';
  }
}
else
{
  $content = 'Please register or login to select themes';
}

?>


ps:
May not work with non-standard Your_Account module.

_________________
I'm Image
Find all posts by madmanView user's profileSend private messageVisit poster's websiteYahoo MessengerMSN Messenger
jib_intelli
Captain
Captain


Joined: Jun 10, 2004
Posts: 338

Location: Lucknow, India

PostPosted: Tue Dec 28, 2004 3:57 am Reply with quoteBack to top

Thanks for the code! It was much help Smile

_________________
It is not our abilities which decide what we truly are, it is our choices.

Image
Find all posts by jib_intelliView user's profileSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN Messenger
topdog2k
Nuke Soldier
Nuke Soldier


Joined: Oct 21, 2004
Posts: 32


PostPosted: Thu Dec 30, 2004 8:10 pm Reply with quoteBack to top

This is the theme block I use, can this block be edited so it can be used to change the Forum theme or "board style" instead??

Code:


<?php

/************************************************************************/
/* PHP-NUKE BLOCKS V3.1 : Block - Themes For PHP-Nuke 6.0 - 6.5         */
/* ================================                                     */
/*                                             */
/* Updated and Fixed - Jerry Fow                          */
/*                     a.k.a. Linzilla (webmaster@phpnukefiles.com)     */
/*                                            */
/* Copyright (c) 2003 by Sudirman Angriawan(nukecpower@yahoo.com)      */
/* http://www.nukec.cjb.net                                             */
/*                                                                      */
/* Credit for ThemesBlock 2.0 Harry Mangindaan (sens@indosat.net.id)    */
/* http://www.NukeStars.com                                             */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if (eregi("block-Themes.php", $PHP_SELF)) {
    Header("Location: index.php");
    die();

}
 global $user, $userinfo, $Default_Theme, $cookie;

getusrinfo($user);
$content .="<center>";
$content .= "<form action=\"modules.php?name=Your_Account\" method=\"post\">";
$content .= ""._MEMBERSONLY."<BR><BR>";
$content .= ""._SELECTTHEME."<BR>";
$content .= "<select name=\"theme\" onchange=submit();>";
    $handle=opendir('themes');
    while ($file = readdir($handle)) {
   if ( (!ereg("[.]",$file)) ) {
      $themelist .= "$file ";
   }
    }
    closedir($handle);
    $themelist = explode(" ", $themelist);
    sort($themelist);
    for ($i=0; $i < sizeof($themelist); $i++) {
       if($themelist[$i]!="") {
           $content .= "<option value=\"$themelist[$i]\" ";
       if((($userinfo[theme]=="") && ($themelist[$i]=="$Default_Theme")) || ($userinfo[theme]==$themelist[$i])) $content .= "selected";
       $content .= ">$themelist[$i]\n";
   }
    }
$content .= "</select>";

   $content .= "<input type=\"hidden\" name=\"storynum\" value=\"$userinfo[storynum]\">";
   $content .= "<input type=\"hidden\" name=\"ublockon\" value=\"$userinfo[ublockon]\">";
   $content .= "<input type=\"hidden\" name=\"ublock\" value=\"$userinfo[ublock]\">";
   $content .= "<input type=\"hidden\" name=\"uname\" value=\"$userinfo[uname]\">";
   $content .= "<input type=\"hidden\" name=\"user_id\" value=\"$userinfo[user_id]\">";
   $content .= "<input type=\"hidden\" name=\"op\" value=\"savetheme\">";

$content .= "</form>";
$content .= "</center>";


?>
Find all posts by topdog2kView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.103 Seconds - 201 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::