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, 47 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 - Inserting text just below the header [ ]
 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
Antra
Sergeant
Sergeant


Joined: Mar 15, 2003
Posts: 143


PostPosted: Wed Apr 30, 2003 3:56 pm Reply with quoteBack to top

I have a function defined that upon calling it, this function(); works just fine. But I'd like the text to be displayed just below the header graphic. I don't know how to take this PHP function call and make the output appear where I want it to. This is one of the final tweaks I'm going to be doing to my site and I'd like to take a break from nuking for a while Smile. Any tips?
Find all posts by AntraView user's profileSend private messageVisit poster's website
Raven
General
General


Joined: Mar 22, 2003
Posts: 5233

Location: USA

PostPosted: Wed Apr 30, 2003 5:08 pm Reply with quoteBack to top

I assume when you say 'this text' you are referring to the output of your function? In any event, modify the theme. Find where your logo.gif is called (ex. header.html if using fiapple) and call the function from there.

_________________
Those who hear not the music think the dancers mad.
Raven Web Hosting|My Scripts & Stuff
Find all posts by RavenView user's profileSend private messageVisit poster's website
Antra
Sergeant
Sergeant


Joined: Mar 15, 2003
Posts: 143


PostPosted: Thu May 01, 2003 8:03 am Reply with quoteBack to top

That's just it. How do you call a PHP function from within HTML? And yes, it's header.html -- using a heavily modified smartDark.
Find all posts by AntraView user's profileSend private messageVisit poster's website
Raven
General
General


Joined: Mar 22, 2003
Posts: 5233

Location: USA

PostPosted: Thu May 01, 2003 8:14 am Reply with quoteBack to top

You use embedded php code. Here is a snippet of the header.html code from the NukeNews theme.
Code:
<br>
<table cellpadding="0" cellspacing="0" width="100%" border="0" align="center" bgcolor="#ffffff">
<tr>
<td bgcolor="#ffffff">
<img height="16" alt="" hspace="0" src="themes/NukeNews/images/corner-top-left.gif" width="17" align="left">
<a href="index.php"><img src="themes/NukeNews/images/logo.gif" align="left" alt=""._WELCOMETO." $sitename" border="0" hspace="10"></a></td>

To embed php code, you would do something like this.
Code:

<br>
<table cellpadding="0" cellspacing="0" width="100%" border="0" align="center" bgcolor="#ffffff">
<tr>
<td bgcolor="#ffffff">
<img height="16" alt="" hspace="0" src="themes/NukeNews/images/corner-top-left.gif" width="17" align="left">
<a href="index.php"><img src="themes/NukeNews/images/logo.gif" align="left" alt=""._WELCOMETO." $sitename" border="0" hspace="10"></a><br><?=textFunction();?></td>

There are many different ways and it will depend on your function of course.

_________________
Those who hear not the music think the dancers mad.
Raven Web Hosting|My Scripts & Stuff
Find all posts by RavenView user's profileSend private messageVisit poster's website
Antra
Sergeant
Sergeant


Joined: Mar 15, 2003
Posts: 143


PostPosted: Thu May 01, 2003 8:21 am Reply with quoteBack to top

*facepalm* I knew it was something easy like that. I'm a php hack, not a programmer Smile. Thanks!
Find all posts by AntraView user's profileSend private messageVisit poster's website
Antra
Sergeant
Sergeant


Joined: Mar 15, 2003
Posts: 143


PostPosted: Thu May 01, 2003 8:29 am Reply with quoteBack to top

Actually, I can't get that to go. Here's what I'm putting in, with the function titled "randomquote" and requiring no input:
Code:
<?=randomquote();?>


I've got the right spot in html, but nothing appears at all...what php file does this function need to be defined in? For now I have it in mainfile.php to be sure it'll be found.
Find all posts by AntraView user's profileSend private messageVisit poster's website
Raven
General
General


Joined: Mar 22, 2003
Posts: 5233

Location: USA

PostPosted: Thu May 01, 2003 8:32 am Reply with quoteBack to top

Does randomquote() return a text string?

You could just place the randomquote function at the beginning of your header.html file instead of mainfile.

_________________
Those who hear not the music think the dancers mad.
Raven Web Hosting|My Scripts & Stuff
Find all posts by RavenView user's profileSend private messageVisit poster's website
Antra
Sergeant
Sergeant


Joined: Mar 15, 2003
Posts: 143


PostPosted: Thu May 01, 2003 8:39 am Reply with quoteBack to top

Aye, it does. I feel stupid for not looking around the 'net more, but from the tutorials I saw (now that you gave me the word "embedded" to search on) it looks like it should be <?php stuff;?> ? Not complaining, I'll go your way Smile.

Just playing around I added this to theme.php under function themeheader: $randomquote = randomquote();

At the very top of the page, outside of all tables and looking just the way I want it to (but not where), it displays the text.

Edit: I tried putting the function definition in the header.html, but I think theme.php (when it calls that file) chokes on it since I kept getting repeated errors. I'm keeping it in mainfile for now.
Find all posts by AntraView user's profileSend private messageVisit poster's website
Raven
General
General


Joined: Mar 22, 2003
Posts: 5233

Location: USA

PostPosted: Thu May 01, 2003 8:54 am Reply with quoteBack to top

Code:
<?php stuff;?>
Is for use when you have to do more than just display code. The code I gave you
Code:
<?=randomquote();?>
assumes that randomquote returns a text string that you would then display with an echo statement. It's a shorthand way is all. You just as easily could place both your function code and the echo statement all within the <? ?> at the spot where you want it displayed. If it isn't working, check your apache error_log to see if there is an error being thrown.

_________________
Those who hear not the music think the dancers mad.
Raven Web Hosting|My Scripts & Stuff
Find all posts by RavenView user's profileSend private messageVisit poster's website
Antra
Sergeant
Sergeant


Joined: Mar 15, 2003
Posts: 143


PostPosted: Thu May 01, 2003 10:15 am Reply with quoteBack to top

If I place it in theme.php it works (kinda) as described above. If I put it in the code example you've shown me here, it returns nothing. Starting to weird me out...
Find all posts by AntraView user's profileSend private messageVisit poster's website
Raven
General
General


Joined: Mar 22, 2003
Posts: 5233

Location: USA

PostPosted: Thu May 01, 2003 10:33 am Reply with quoteBack to top

If you want it looked at any further, you are going to need to post the code down to the point that you embed it.

_________________
Those who hear not the music think the dancers mad.
Raven Web Hosting|My Scripts & Stuff
Find all posts by RavenView user's profileSend private messageVisit poster's website
Antra
Sergeant
Sergeant


Joined: Mar 15, 2003
Posts: 143


PostPosted: Thu May 01, 2003 10:42 am Reply with quoteBack to top

Code in mainfile.php:
Code:
function randomquote() {

$RANDOM_QUOTE_FILE = "quotes.txt";

srand((double)microtime()*1000000);

if (file_exists($RANDOM_QUOTE_FILE)) {
        $array_txt = preg_split("/--NEXT--/", join('', file($RANDOM_QUOTE_FILE)));
        echo "<center><i>".$array_txt[rand(0, sizeof($array_txt) -1)]."</i></center>";
} else {
        echo "Error: can't open $RANDOM_QUOTE_FILE file";
}
}


Code in header.html:
Code:
<?=randomquote();?>
Find all posts by AntraView user's profileSend private messageVisit poster's website
Raven
General
General


Joined: Mar 22, 2003
Posts: 5233

Location: USA

PostPosted: Thu May 01, 2003 10:44 am Reply with quoteBack to top

Your function is NOT returning a text string. That's the problem. Your function ECHOS a text string. Try this:
<? randomquote(); ?>

If this still is not workling, I would imagine it's a pathing error to quotes.txt. Check your apache error_log, or insert a debug statement right at the top like
Code:
echo 'Result = '.file_exists("quotes.txt");die();
If it does not return a 1, then it cannot locate the file.

_________________
Those who hear not the music think the dancers mad.
Raven Web Hosting|My Scripts & Stuff
Find all posts by RavenView user's profileSend private messageVisit poster's website
Antra
Sergeant
Sergeant


Joined: Mar 15, 2003
Posts: 143


PostPosted: Thu May 01, 2003 12:13 pm Reply with quoteBack to top

Oh...sorry, didn't realize the difference. Would it be advisable to tweak it to return rather than echo? The debug string you gave me did indeed return a 1 with my quotes.txt in the phpnuke root.

So, the file is visible. My function is in mainfile.php. I'm calling it with <? randomquote();?>, and nothing shows up. However, I do see the function call directly within the html delievered to the browser. So it's not being evaluated/parsed...could this be a server setting?

Edit/addendum: I also tried doing a silly string like <?php echo "<p>Hello World</p>"; ?>, and it ALSO didn't parse. To me it's looking like any PHP put into the html pages, which will be called by php pages, isn't parsing.
Find all posts by AntraView user's profileSend private messageVisit poster's website
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
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.252 Seconds - 325 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::