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, 248 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 - Calling custom functions in theme [ ]
 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
skistyle
Private
Private


Joined: Dec 29, 2004
Posts: 40


PostPosted: Wed Feb 15, 2006 9:37 pm Reply with quoteBack to top

Hello All,
I'm trying to implement an entirely new layout, still using a PHP-Nuke frame. Obviously, much of the new layout depends on the theme, which will be entirely custom.
However, I must create a few new functions and have them called when a page is generated. Problem is that I don't know what file calls the functions. For instance, the function in theme.php (Of Milo, at least) for "themeheader" is somehow called, as is the "blocks" function within "themeheader". I want to create a new function for logging in, say "loginblock" and have it called within "themeheader". The actual content for this function will be in the file loginblock.php.
I simply can't figure out how this file gets pulled into the theme, and then how the theme's function "themeheader" gets printed to each page in a Nuke site. Can anyone help me out?
I've tried creating a function "loginblock" in the theme.php file, and then call it in the function "themeheader", also in theme.php, but nothing appears in its spot.
I guess as a specific request, how does the "blocks" function get called into "themeheader" and then how does "themeheader" get printed to each page? What files manage this?
Thanks in advance for your help!!!! Exclamation
Find all posts by skistyleView user's profileSend private message
skistyle
Private
Private


Joined: Dec 29, 2004
Posts: 40


PostPosted: Wed Feb 15, 2006 9:48 pm Reply with quoteBack to top

Ok, I know my last post probably wasn't quite clear, but here's a little more help - I hope.

in the base directory, there is loginblock.php (essentially block-login.php) with the code printed below:

Code:
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2005 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* 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 ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}
function loginblock () {
global $admin, $user, $sitekey, $gfx_chk, $admin_file;

mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
$content = "<form onsubmit=\"this.submit.disabled='true'\" action=\"modules.php?name=Your_Account\" method=\"post\">";
$content .= "<center><font class=\"content\">"._NICKNAME."<br>";
$content .= "<input type=\"text\" name=\"username\" size=\"10\" maxlength=\"25\"><br>";
$content .= ""._PASSWORD."<br>";
$content .= "<input type=\"password\" name=\"user_password\" size=\"10\" maxlength=\"20\"><br>";
if (extension_loaded('gd') AND ($gfx_chk == 2 OR $gfx_chk == 4 OR $gfx_chk == 5 OR $gfx_chk == 7)) {
    $content .= ""._SECURITYCODE.": <img src='?gfx=gfx&random_num=$random_num' border='1' alt='"._SECURITYCODE."' title='"._SECURITYCODE."'><br>\n";
    $content .= ""._TYPESECCODE."<br><input type=\"text\" NAME=\"gfx_check\" SIZE=\"7\" MAXLENGTH=\"6\">\n";
    $content .= "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\"><br>\n";
} else {
    $content .= "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">";
    $content .= "<input type=\"hidden\" name=\"gfx_check\" value=\"$code\">";
}
$content .= "<input type=\"hidden\" name=\"op\" value=\"login\">";
$content .= "<input type=\"submit\" value=\""._LOGIN."\"></font></center></form>";
$content .= "<center><font class=\"content\">"._ASREGISTERED."</font></center>";

if (is_admin($admin) AND is_user($user)) {
    $content = "<center>"._ADMIN."<br>[ <a href=\"".$admin_file.".php?op=logout\">"._LOGOUT."</a> ]</center>";
}
}
?>


Then, in theme.php, i call the function "loginblock();"

and the output is:

Fatal error: Call to undefined function: loginblock() in /home/njdirtc/public_html/06/themes/Spray/theme.php on line 123

Line 123 is "loginblock();"

Sooo...how do I "define" loginblock() ?

Again, thanks!
Find all posts by skistyleView user's profileSend private message
skistyle
Private
Private


Joined: Dec 29, 2004
Posts: 40


PostPosted: Wed Feb 15, 2006 10:26 pm Reply with quoteBack to top

Ok, so these functions are controlled in mainfile.php (or so it seems) Wink

When I run into trouble, which will inevitably happen, I'll post again here.

For now though - does Nuke 7.8 have any check to make sure that all login attempts are comign from block-login or your_account? I have made a few attempts at custom blocks for login, and, while I've had success with older nuke versions, my blocks won't work with 7.8.
Find all posts by skistyleView user's profileSend private message
webjunky
Lieutenant
Lieutenant


Joined: May 11, 2003
Posts: 167


PostPosted: Thu Feb 16, 2006 7:45 am Reply with quoteBack to top

add

require_once("blocks/block-Login.php");

before line 123 to theme.php
Then you can use all the functions in this file and all the functions in the files which block-Login.php links to
Find all posts by webjunkyView user's profileSend private message
skistyle
Private
Private


Joined: Dec 29, 2004
Posts: 40


PostPosted: Thu Feb 16, 2006 9:33 am Reply with quoteBack to top

Ah, thanks very much, that clarifies everything! I figured I'd have to specify the file location, but I was using "include("file") for some reason. Again thanks for your help!
Find all posts by skistyleView user's profileSend private message
skistyle
Private
Private


Joined: Dec 29, 2004
Posts: 40


PostPosted: Thu Feb 16, 2006 3:36 pm Reply with quoteBack to top

I've insterted

require_once("square/loginblock.php");

above the call for "loginblock()" in theme.php and it still causes an error. However, the error prevents the page from appearing.

I have a directory in the base dir. called "square" and a file within it called "loginblock.php" which is shown in the second post

When I put the same code block into mainfile.php and then call "loginblock()" without the "require_once" line, it seems to work.

That would be fine, exept that I'll be doing this with a few functions and I don't want everything to run through mainfile.php. Any idea why my attempt to link the function to loginblock.php failed? Maybe its the code within it?

Thanks in advance!
Find all posts by skistyleView user's profileSend private message
skistyle
Private
Private


Joined: Dec 29, 2004
Posts: 40


PostPosted: Sun Feb 19, 2006 11:56 am Reply with quoteBack to top

Now that I've got some of that stuff out of the way, I'd like to rework how the News, which is the home module, is shown on my page. I want this to show inside of an IFrame, which links to a file called news.php whose code is below:

Code:
<?php
//define('MODULE_FILE', true);
require_once("http://www.njdirt.com/06/modules.php?name=News");

theindex($new_topic="0");

?>


I would like to have the news, or what would be the center block in index.php scroll in the IFrame. Any idea how I might get that done? Best I can figure is that "theindex" function in the News module controls this, but my code returns the entire theme.php file instead of the "themeindex" function for the stories.

Thanks!
Find all posts by skistyleView user's profileSend private message
webjunky
Lieutenant
Lieutenant


Joined: May 11, 2003
Posts: 167


PostPosted: Mon Feb 20, 2006 12:35 am Reply with quoteBack to top

skistyle wrote:
I've insterted

require_once("square/loginblock.php");

above the call for "loginblock()" in theme.php and it still causes an error. However, the error prevents the page from appearing.

I have a directory in the base dir. called "square" and a file within it called "loginblock.php" which is shown in the second post

When I put the same code block into mainfile.php and then call "loginblock()" without the "require_once" line, it seems to work.

That would be fine, exept that I'll be doing this with a few functions and I don't want everything to run through mainfile.php. Any idea why my attempt to link the function to loginblock.php failed? Maybe its the code within it?

Thanks in advance!


What is the exact error message?
Find all posts by webjunkyView user's profileSend private message
skistyle
Private
Private


Joined: Dec 29, 2004
Posts: 40


PostPosted: Mon Feb 20, 2006 8:14 pm Reply with quoteBack to top

Sorry for taking so long to respond to my own thread...but I just got it after trying to forget about it for a few days!

For other people though...

require_once("square/loginblock.php");
loginblock();

gave me the right code when loginblock.php consists ONLY of the function loginblock() and loginblock.php is found in the dir. "square"

Thanks webjunky for your help!
Find all posts by skistyleView user's profileSend private message
skistyle
Private
Private


Joined: Dec 29, 2004
Posts: 40


PostPosted: Tue Feb 21, 2006 5:22 pm Reply with quoteBack to top

Okay, so the login block worked as did some other blocks I put in.

Now, I'm trying to bring ShoutBlock into a theme in a way other than through blocks, similar to the loginblock mentioned above.

I'm having trouble with this block becuase it has multiple functions in it and uses javascript. I am not sure how to pull a series of functions like in block-Shoutblock.

Can somebody suggest a way that will pull this code from the block's file, blocks/block-ShoutBlock.php, and into the theme.php file to be outputted?

The shoutblock is actually a frontend for the ShoutBlock module, and I can explain more about it if anyone needs, but I assume most people know of it.

Thanks in advance!
Find all posts by skistyleView user's profileSend private message
skistyle
Private
Private


Joined: Dec 29, 2004
Posts: 40


PostPosted: Tue Feb 28, 2006 2:06 pm Reply with quoteBack to top

I'm still trying to get the stuff in my last post to work, and I can't figure it out...bump
Find all posts by skistyleView 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.064 Seconds - 162 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::