Author Topic: Help with small get if statment  (Read 3789 times)

0 Members and 1 Guest are viewing this topic.

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Help with small get if statment
« Reply #15 on: March 20, 2010, 02:18:06 AM »
That is helpful thanks.

I hope is work for you.  also some more of the code in php

$user5 = $row['submitter'];   
   $smarty->assign('user5', $user5)
echo "
";

winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Help with small get if statment
« Reply #16 on: March 20, 2010, 02:22:44 AM »
here is a nice peace of code if you care how long it takes a page to load

<?php
// Get Current Time
$mtime = microtime();
// Split Seconds and Microseconds
$mtime = explode (" ", $mtime);
// Create a single value for start time
$mtime = $mtime[1] + $mtime[0];
// Write Start Time Into A Variable
$tstart = $mtime;

// Get current time (Like above) to get end time
$mtime = microtime();
$mtime = explode (" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
// Store end time in a variable
$tend = $mtime;
// Calculate Difference
$totaltime = ($tend - $tstart);
// Output the result
printf ("This page was generated in %f seconds.", $totaltime);
?>
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Help with small get if statment
« Reply #17 on: March 20, 2010, 02:28:53 AM »
did it work for you?
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline FireDart

  • Project Leader
  • Pro Member
  • *****
  • Posts: 406
  • Karma: 4
    • View Profile
    • FireDart
Re: Help with small get if statment
« Reply #18 on: March 20, 2010, 02:30:38 AM »
Going to bed, I will try it next morning.

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Help with small get if statment
« Reply #19 on: March 20, 2010, 02:34:52 AM »
later.........
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline FireDart

  • Project Leader
  • Pro Member
  • *****
  • Posts: 406
  • Karma: 4
    • View Profile
    • FireDart
Re: Help with small get if statment
« Reply #20 on: March 20, 2010, 02:32:44 PM »
Got the individual pages working, example:
index.php?id=media&m=1 or index.php?id=media&m=2 etc..

Just need to get it so on the index.php?id=media it shows the most recent media.

Demo:
Index: http://www.firedartonline.com/phpdirector/
Media: http://www.firedartonline.com/phpdirector/index.php?id=media
Media Page 1: http://www.firedartonline.com/phpdirector/index.php?id=media&m=1
Media Page 2: http://www.firedartonline.com/phpdirector/index.php?id=media&m=2

View attachments.
« Last Edit: March 20, 2010, 02:54:23 PM by FireDart »

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Help with small get if statment
« Reply #21 on: March 21, 2010, 12:39:17 AM »
I like it. :) thumb's up from me! if you want to e-mail me the code I will help
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline FireDart

  • Project Leader
  • Pro Member
  • *****
  • Posts: 406
  • Karma: 4
    • View Profile
    • FireDart
Re: Help with small get if statment
« Reply #22 on: March 21, 2010, 01:05:07 AM »
Let me get the files together and I will E-Mail you.

--Later--

I E-mail what am trying to do, our you good with contacting MySql DB's and displaying the info? Am trying to make the global.php file dynamically update depending on current DB info, so if you can get that working that would be great. ;)

Also I plan on using the php function() feature for most of the script, to help stream line the code into easy to use snippets, which would be located in the "global.php".
« Last Edit: March 21, 2010, 01:07:51 AM by FireDart »

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Help with small get if statment
« Reply #23 on: March 21, 2010, 02:51:19 AM »
you good with contacting MySql DB's and displaying the info?

yes, i will see what i can do.
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Help with small get if statment
« Reply #24 on: March 23, 2010, 08:03:20 PM »
Firedart I sent you a e-mail
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com

Offline FireDart

  • Project Leader
  • Pro Member
  • *****
  • Posts: 406
  • Karma: 4
    • View Profile
    • FireDart
Re: Help with small get if statment
« Reply #25 on: March 24, 2010, 12:56:13 AM »
Thanks for the E-Mail, add more array options and styled the results:
http://www.firedartonline.com/phpdirector/index.php?id=media

media.php
Code: [Select]
<?php
/*
********************
PHPDirector - Media
********************
*/
/* Grab Media ID */
if(isset($_GET['m'])) {
/* Find URL Value */
$urlmediaid $_GET['m'];

/* Grab Results from DB */
$query "Select * FROM phpdir_media WHERE ID = $urlmediaid";
$result mysql_query($query);

/* Display Results */
$media mysql_fetch_array($result);

/* Assign Values to Smarty */
$smarty->assign('media_mediaid'$media['id']);
$smarty->assign('media_name'$media['name']);
$smarty->assign('media_creator'$media['creator']);
$smarty->assign('media_description'$media['description']);
$smarty->assign('media_date'$media['date']);
$smarty->assign('media_views'$media['views']);
$smarty->assign('media_mediatype'$media['video_type']);
$smarty->assign('media_approved'$media['approved']);
$smarty->assign('media_featured'$media['featured']);
$smarty->assign('media_rejected'$media['rejected']);
$smarty->assign('media_category'$media['category']);
$smarty->assign('media_pictures'$media['pictures']);
$smarty->assign('media_file'$media['file']);
$smarty->assign('media_ip'$media['ip']);

} else {
/* If no media value selected Display newest media */
/* Grab Results from DB */  
$newestmediaresult mysql_query("SELECT * FROM phpdir_media");
  
  
/* Display via Array */
$userresult = array();
do {
while ($newestmediarow mysql_fetch_array($newestmediaresult MYSQL_ASSOC)) {
$userresult[] = array(
"id" => $newestmediarow['id'],
"name" => $newestmediarow['name'],
"creator" => $newestmediarow['creator'],
"description" => $newestmediarow['description'],
"date" => $newestmediarow['date'],
"views" => $newestmediarow['views'],
"video_type" => $newestmediarow['video_type'],
"pictures" => $newestmediarow['pictures'],
"category" => $newestmediarow['category'],
);

}
}
while (! EOF);
$smarty->assign('userresult'$userresult);
}


/* Display Template */
$smarty->display('media.tpl');
?>


media.tpl
Code: [Select]
{{include file="header.tpl" title=Media}}

<div id="mediawrapper">
{{if $media_approved eq "1"}}
<h1>{{$media_name}}</h1>
<div id="media">
{{include file="players.tpl"}}
</div>
<div id="info">
<img class="media_picture" alt="" src="{{$media_pictures}}" />
<b>ID:</b> {{$media_mediaid}}
<br />
<b>Name:</b> {{$media_name}}
<br />
<b>Creator:</b> {{$media_creator}}
<br />
<div class="clearer"> </div>
<b>Description:</b>
<pre style="white-space: pre-wrap; word-wrap: break-word; height: 250px; overflow: auto;">
{{$media_description}}
</pre>
<br />
<b>Released:</b> {{$media_date}}
<br />
<b>Views:</b> {{$media_views}}
<br />
<b>Source:</b> {{$media_mediatype}}
<br />
<b>Approved:</b> {{$media_approved}}
<br />
<b>Featured:</b> {{$media_featured}}
<br />
<b>Rejected:</b> {{$media_rejected}}
<br />
<b>Category:</b> {{$media_category}}
<br />
<b>File ID:</b> {{$media_file}}
<br />
<b>CreatorIP:</b> {{$media_ip}}
</div>
{{else}}
<h1>Newest Media</h1>
{{foreach from=$userresult key=myid item=newmedia}}
<div class="new_media">
<a href="index.php?id=media&amp;m={{$newmedia.id}}"><img class="new_media_img" alt="{{$newmedia.name}}" src="{{$newmedia.pictures}}" /></a>
<a href="index.php?id=media&amp;m={{$newmedia.id}}">{{$newmedia.name}}</a>
<br />
<b>By:</b> {{$newmedia.creator}}
<br />
<b>Added:</b> {{$newmedia.date}}
<br />
<b>Description:</b>
<br />
{{$newmedia.description|truncate:200:'...'}}
</div>
{{/foreach}}
{{/if}}
</div>
{{include file="footer.tpl"}}

Now on too SmartyPaginate ;)

Offline winracer

  • Development Team
  • Pro Member
  • *******
  • Posts: 446
  • Karma: 3
    • View Profile
    • helpmewithperl.com
  • Script Version: 1.0+
Re: Help with small get if statment
« Reply #26 on: March 24, 2010, 11:54:46 AM »
cool works :)
« Last Edit: March 24, 2010, 12:00:23 PM by winracer »
winracer
myfunnypets.com
helpmewithperl.com
coosavalleyclassifieds.com
brownlows.net
myphpforum.com