Jump to content

Not Sure if THis Is a Bug


TAV1702

Recommended Posts

Hi Nabeel. I followed Rogers tutorial on skinning and I did my forgot password like he did his. Great little tip indeed  ;)

So I proceeded to do that to a couple other pages as well, like file new pirep and login.

Well, on all extra pages (file pirep and login), I get this for users online

Warning: Invalid argument supplied for foreach() in /home/xxxxxx/public_html/xxxxxx/lib/skins/Storm/login_form.tpl on line 32

But yet on my home page it works just fine. Thus me not thinking it is a bug but rather a coding error. Problem is, I never changed any code. All I did was copy and paste from my frontpage_main.tpl so there should not be any code errors at all.

Also, I am having major issues getting images to stay on my site. I hard code them in and they are there, then they are gone then they come back, then they are gone again. If I put all my images in .css they are there and stay there for good.

AND 1 more if I may please.  ;D  How on gods green earth do I make it so the first letter of my Nav words are capitol instead of lower case? I have changed my core_nav and it is no good. They will not change. I moved that file into my skin by the way. ;)

Link to comment
Share on other sites

Well, as far as the image thing goes, I will give an example.

I have it setup on my front page so that if you are NOT logged in, it shows a picture and some info without any news at all. Once the user logs in, the image on the front page goes away and so does the info, but now the news is there as it should be. I coded it just like the nav where you see this if a guest else see this if you are a logged in member.

Now here in lies the issue. All is well until a user logs out. At witch time it goes back to my url http://paranormalinsights.com/phpVMS

i did some testing and if the logout function would return me to http://paranormalinsights.com/phpVMS/index.php , then the images do not disappear.

So now I'm trying to figure this riddle out. I guess it falls into the same category that I had originally posted about.

Link to comment
Share on other sites

thanks on the css link, and here is my code to see if they are logged in or not and what to show.

<?php
if(!Auth::LoggedIn())
{
// Show these if they haven't logged in yet
?>
<insert my page content here if not logged in>
                    
		<?php
}
else
{
         // Show the news items only if they are logged in
// Show the News module, call the function ShowNewsFront
//	This is in the modules/Frontpage folder

News::ShowNewsFront(5);
?>
<?php
}
?>

Basically, I ripped the code from core_nav.tpl and inserted my own content to it where it says insert my page content here.

Like I said though, if it redirects back to myurl/index.php it is fine but if it just goes back to myurl/  the images disappear. And it is not only where I inserted that in place of the news. I have images that are 100% of the time supposed to show up and dont.

If this has confused you, I can zip up my files and let you take a peak at them as long as you promise not to laugh at my markup  ;D

Thanks for the quick reply. I appreciate it.

Link to comment
Share on other sites

No I did not modify it at all. Like I said, the only mods I made were to login and forgot password and one more. And all I did was copy my frontpage_main.tpl and replaced the main content with the content from those few pages were applicable so them pages looked full site like the home page.

For more info on how I did it, view the skinning tut part 2 where he fixed up the forgot password page. I did it exactly like that. No variations at all.

Link to comment
Share on other sites

  • Administrators

No I did not modify it at all. Like I said, the only mods I made were to login and forgot password and one more. And all I did was copy my frontpage_main.tpl and replaced the main content with the content from those few pages were applicable so them pages looked full site like the home page.

For more info on how I did it, view the skinning tut part 2 where he fixed up the forgot password page. I did it exactly like that. No variations at all.

That's probably the issue, copying the contents into other pages, without the variables being setup in the controllers. I'd have to see code, I haven't seen his tutorial

Link to comment
Share on other sites

this one is login

<div id="content">
    <div id="content-left">
		<center><h3>Game Servers</h3></center>
		<hr>
         <table width="100%" border="0" bordercolor="#b30000" align="center" bgcolor="">
			<tr>
				<td width="65%">Game Server</td>
				<td style="color:lime"><b>Online</b></td>
                                </tr>
			<tr>
				<td>TeamSpeak<br>Community IP Address:<br>xxx.xx.xx.xxx:8767</td>
				<td style="color:lime"><b>Online</b></td>
			</tr>
			<tr>
				<td>ATC Server</td>
				<td style="color:red"><b>Offline</b></td>
			</tr>
		</table>
		<hr>
<center><h3>Users Online</h3></center>
<hr>
<p><i>There have been <?php echo count($usersonline)?> user(s) in the past <?php echo Config::Get('USERS_ONLINE_TIME')?> minutes.</i></p>

<?php
/* $usersonline also has the list of users -
	really simple example

	Or if you're not on the frontpage:
	$usersonline = StatsData::UsersOnline();

*/
foreach($usersonline as $pilot)	
{
	echo "{$pilot->firstname} {$pilot->lastname}<br />";
}

?>
<hr>
   <center><h3>VA Statistics</h3></center>
    <hr>
        <p>Total Pilots: <?php echo StatsData::PilotCount(); ?></p>
        <p>Total Flights: <?php echo StatsData::TotalFlights(); ?></p>
        <p>Total Flights Today: <?php VastatsData::totalflightstoday(); ?></p>
        <p>Total Flight Hours: <?php echo StatsData::TotalHours(); ?></p>
        <p>Total PAX Carried: <?php VastatsData::totalpaxcarried(); ?></p>
        <p>Total Fuel Burned: <?php VastatsData::totalfuelburned(); ?></p>
        <p>Total Miles Flown: <?php VastatsData::totalmilesflown(); ?></p>
        <p>Total Aircraft: <?php VastatsData::totalaircraftinfleet(); ?></p>
        <p>Total Schedules: <?php VastatsData::totalschedules(); ?></p>
        <p>Total News Items: <?php VastatsData::totalnewsitems(); ?></p>
	</div>
    <div id="content-main">
<h1>Login</h1>
<form name="loginform" action="<?php echo url('/login');?>" method="post">
<?php echo "<?xml version='1.0'?>"; ?>
<?php
if(isset($message))
echo '<p class="error">'.$message.'</p>';
?>
<dl>
<dt>E-mail Address:</dt>
<dd><input type="text" name="email" value="" />

<dt>Password:</dt>
<dd><input type="password" name="password" value="" />
   
<dt></dt>
<dd>Remember Me? <input type="checkbox" name="remember" /></dd>

<dt></dt>
<dd><input type="hidden" name="redir" value="index.php/profile" />
	<input type="hidden" name="action" value="login" />
	<input type="submit" name="submit" value="Log In" />



<dt></dt>
<dd><a href="<?php echo url('Login/forgotpassword'); ?>">I forgot my password</a></dd>
</dl>
</form>
	</div>
    <div id="content-right">

<center><h3>Recent Reports</h3></center>
<hr>
<?php MainController::Run('PIREPS', 'RecentFrontPage', 5); ?>
    <hr>
<center><h3>Newest Pilots</h3></center>
<hr>
<?php MainController::Run('Pilots', 'RecentFrontPage', 5); ?>
<hr>
<center><h3>Partners</h3></center>
<hr>
<br />
<center>
<a href="http://www.fspassengers.com" target="_blank"><img src="../images/108x35FspBannerPirep2.jpg"></a></img><br />
	</center>
	</div>
  </div>

The other pages were done exactly like this one. All it does is just make the pages look more full and uniform rather than just something on the left side of the screen with a header and footer. Makes the pages look more like the rest of the site.

Link to comment
Share on other sites

  • Administrators

You'll get an error about $usersonline since that's not defined.

If every page is like that, you could have added that code into the header/footer.tpl, or created a new .tpl file and did

Template::Show('sidebar.tpl');

So you don't have to copy/paste that same code all throughout

Link to comment
Share on other sites

Good point. I never thought of that.  ;D I can just get rid of the users online info from them pages for now if I have to. I have been trying to fix so much of my little coding mistakes that I am about ready to punch my monitor.  ;)  This skin stuff is just aching my arse real bad like.  ;D ;D

Link to comment
Share on other sites

Ok 1 thing, we discussed the users online on the extra pages thing. And you gave me 2 extra lines to add to the code and it works like a charm....... BUT

There have been 0 user(s) in the past 60 minutes.

Warning: Invalid argument supplied for foreach() in /home/xxxxxxxx/public_html/phpVMS/lib/skins/Storm/frontpage_main.tpl on line 32

That is what I get when I come to the website and no one has been on in the last 60 minutes. Now that I have logged on to the site, I can log on and off a million times and it will NEVER error out on me again.

Stay away from the site for 60 minutes from the last login and the error comes back. I'm thinking of commenting out the user names for users online like it originally was, but that is only going to put a band aid on the problem.

This is my frontpage code, it was never altered because it never had that problem.

<p><i>There have been <?php echo count($usersonline)?> user(s) in the past <?php echo Config::Get('USERS_ONLINE_TIME')?> minutes.</i></p>

<?php
/* $usersonline also has the list of users -
	really simple example

	Or if you're not on the frontpage:
	$usersonline = StatsData::UsersOnline();

*/
foreach($usersonline as $pilot)	
{
	echo "{$pilot->firstname} {$pilot->lastname}<br />";
}

?>

This is the code from the extra pages that I made with the code ADDED that you gave me to add. Remember them pages work now excellent with the code. BUT they are the exact same as the frontpage if no one has been on for longer thatn set time in the config file.

<p><i>There have been <?php echo count($usersonline)?> user(s) in the past <?php echo Config::Get('USERS_ONLINE_TIME')?> minutes.</i></p>

<?php
/* $usersonline also has the list of users -
	really simple example

	Or if you're not on the frontpage:
	$usersonline = StatsData::UsersOnline();

*/
$usersonline = StatsData::UsersOnline();
$guestsonline = StatsData::GuestsOnline();
foreach($usersonline as $pilot)
{
	echo "{$pilot->firstname} {$pilot->lastname}<br />";
}

?>

Did I add the 2 lines that you gave me to the right place? I'm sure I did. It is the other problem that is the isue now.

Like I said, I can comment out the users Real name again like it is default, OR, I can set my users online to 24 hours to help the situation out.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...