View unanswered posts | View active topics
| Author |
Message |
|
steet
|
Post subject: A piece of the site code! Posted: Sun Aug 20, 2006 11:58 am |
|
|
| Animation Source is my home! |
 |
 |
Joined: Fri Dec 31, 2004 2:14 am Posts: 5743 Location: France
Gender: Male
|
Have you ever wondered how the site code looked like?
Well, here's the full code for the new "Random" page on the site!
- Code: Select all
<? if($lang == 1) { $titre="Page 'au hasard'"; $ongl[1] = "Hasard"; } else { $titre="Random page"; $ongl[1] = "Random"; }
include("ong.php");
$sql_article = "SELECT num, auteur, titre FROM ".$lg['article']." WHERE actif = 1 AND lang = ".$lang; $url_article = $lg['page'].".php?act=b1articles&ong=1&numg=";
$sql_fanfic = "SELECT numfic, nomfic, nom, a.numaut FROM ".$lg['autfic']." a, ".$lg['author']." b WHERE a.numaut = b.numaut AND new <> 2 AND en = ".($lang-1)." AND ready = 1"; $url_fanfic = "fanfic.php?lang=".$lang."&nsite=".$nsite."&num=";
$sql_video = "SELECT numvid, nomvid, nom, a.numaut, url FROM ".$lg['avideos']." a, ".$lg['avidaut']." b WHERE a.numaut = b.numaut AND new <> 2"; $url_video = "";
$sql_topic = "SELECT topic_id, topic_title, username FROM ".$lg['phpbb_topics'].", ".$lg['phpbb_users']." WHERE topic_poster = user_id";
if($lang == 1) $url_topic = "http://baltosource.timduru.org/forum/viewtopic.php?t="; else $url_topic = "http://baltosource.timduru.org/board/viewtopic.php?t="; $sql_question = "SELECT num, auteur, titre FROM ".$lg['aquest']." WHERE actif = 1 AND lang = ".$lang; $url_question = $lg['page'].".php?act=question&num=";
$list_objects = array("0" => array(($lang==2)?"An article":"Un article", $sql_article, $url_article, "auteur", "titre", "num"), "1" => array(($lang==2)?"A fanfic":"Une fanfic", $sql_fanfic, $url_fanfic, "nom", "nomfic", "numfic"), "2" => array(($lang==2)?"A music video":"Une vidéo de fan", $sql_video, $url_video, "nom", "nomvid", "numvid"), "3" => array(($lang==2)?"A question":"Une question", $sql_question, $url_question, "auteur", "titre", "num"), "4" => array(($lang==2)?"A forum topic":"Un sujet de forum", $sql_topic, $url_topic, "username", "topic_title", "topic_id") );
?><blockquote><i><? echo ($lang==1) ? "Vous vous ennuyez? Visitez cette page! Et rafraichissez-la (F5 sur votre clavier) pour avoir de nouveaux trucs au hasard postés sur le site!":"Bored? Don't know what to do? Visit this page! And refresh it (F5 on your keyboard) to get new random stuff posted on the site!";
?></i></blockquote><br />
<div style="float:left; width:300px;"> <?
foreach($list_objects as $object) { displayObject($object); }
?> </div>
</div> <div style="float:right; width:190px;"> <?
$sql_fanart = "SELECT nodessin, a.nom, a.numart, name FROM artdraw a, ".$lg['artist']." b WHERE updated = 1 AND site = ".$nsite." AND a.numart = b.numart"; $url_fanart = $lg['page'].".php?act=fan&lang=".$lang."&nsite=".$nsite."&numg="; if($nsite == 1) $url2 = "affArt.php?lang=".$lang."&nsite=".$nsite; else $url2 = "../affArt.php?lang=".$lang."&nsite=".$nsite; $list_objects = array("0" => array(($lang==2)?"A fanart":"Un fanart", $sql_fanart, $url_fanart, "nom", "nodessin", "numart", $url2)); foreach($list_objects as $object) { displayArt($object); }
?> </div> <?
include("ongbas.php");
function displayObject($object) { global $lang; $sql = $object[1]." ORDER BY RAND() LIMIT 1"; $res = mysql_query($sql); $data = mysql_fetch_array($res); echo "<strong>".$object[0].": </strong><br />";
?> <a href="<? if(empty($object[2])) echo $data['url']; else { echo $object[2]; echo $data[$object[5]]; } ?>"> <? if(strlen($data[$object[4]]) > 30) $champ = substr($data[$object[4]], 0, 30)."..."; else $champ = $data[$object[4]]; ?> <span class="f9"><? echo "- ".$champ; ?></span>, <span class="b9"><? if($lang == 1) echo "par"; else echo "by"; ?></span> <span class="b9i" style="font-size:10px"><? echo $data[$object[3]]; ?></span> <br /><br /> </a>
<? }
function displayArt($object) { global $lang; $sql = $object[1]." ORDER BY RAND() LIMIT 1"; $res = mysql_query($sql); $data = mysql_fetch_array($res); echo "<strong>".$object[0].": </strong><br />";
$pseudo_draw = $data['name']; $imagesrc = "img/fan/".$pseudo_draw."/".$pseudo_draw.$data['nodessin']; $imagep = $imagesrc."p.jpg"; $imageg = $imagesrc.".jpg";
if(!file_exists($imageg)) { $imageg.".gif"; } if(file_exists($imagep) && file_exists($imageg)) { ?> <br /> <center> <a href="<? echo $object[6]."&numart=".$data['numart']."&no=".$data['nodessin']; ?>"> <img src="<? echo $imagep; ?>" border="0" style="vertical-align:middle;border-color: 356981;"/> </a>
<br />
<a href="<? if(empty($object[2])) echo $data['url']; else { echo $object[2]; echo $data[$object[5]]; } ?>"> <span class="b9i" style="font-size:14px"><? echo $data[$object[3]]; ?></span> </a> </center> <? } }
Yes, I've written all this myself. Is it what you expected? Someone wants to correct my code? 
_________________ Webmaster of Animation Source, and more
|
|
| Top |
|
 |
|
white wolf
|
Post subject: Posted: Sun Aug 20, 2006 12:04 pm |
|
|
| Famous one |
 |
 |
Joined: Tue Mar 08, 2005 6:57 pm Posts: 1556 Location: Hot Atlanta! A-Town Down
Gender: Male
|
|
And I understand nothing of that! Lol So how long does it take to make something like that?
_________________ Get Rich Quick! Simply set up a premium phone line. To find out more call 1-900- 478-8743
Is your memory letting you down? And what about your memory..is it letting you down? Call for an information pack quick before you forget
|
|
| Top |
|
 |
|
Kari
|
Post subject: Posted: Sun Aug 20, 2006 12:12 pm |
|
|
| Animation Source is my home! |
 |
 |
Joined: Fri Feb 03, 2006 5:36 pm Posts: 2313 Location: Maryland
Gender: Female
|
If the random part of the site looks like that, I'd be scared to know what the entire site code looks like.
I can only understand part of HTML, and the French makes it a bit harder...so, I can only understand a few certain tags that you used. (<b></br>,<center></center>,<a href></a>...)
That stuff is confusing...
_________________
 ^ click it, you know you want to 8D
I gave up everything sane a while ago.
|
|
| Top |
|
 |
|
steet
|
Post subject: Posted: Sun Aug 20, 2006 12:26 pm |
|
|
| Animation Source is my home! |
 |
 |
Joined: Fri Dec 31, 2004 2:14 am Posts: 5743 Location: France
Gender: Male
|
Around one hour. But it depends, it's often on the little things or details that I spend the most time. It's often like that with programming : we get often stuck with very little annoying details...
Oh and BTW I'm talking about this page :
http://baltosource.timduru.org/balto-act-random.html
_________________ Webmaster of Animation Source, and more
|
|
| Top |
|
 |
|
lobo1235
|
Post subject: Posted: Sun Aug 20, 2006 1:36 pm |
|
|
| Living here |
 |
 |
Joined: Sun Apr 23, 2006 10:46 am Posts: 976 Location: Middle of Nowhere, Ohio
Gender: Female
|
|
i dont know what that means
_________________
I drew the signature picture and avatar myself.
Come check out my Art Gallery on lion king/Balto source. Im getting a spirit & All Dogs Go to Heven one also.
|
|
| Top |
|
 |
|
steet
|
Post subject: Posted: Sun Aug 20, 2006 3:08 pm |
|
|
| Animation Source is my home! |
 |
 |
Joined: Fri Dec 31, 2004 2:14 am Posts: 5743 Location: France
Gender: Male
|
Togo wrote: Well, it's easier with right click -> view code. No : The PHP code you see here is executed on the server side. It's impossible for you to see it. You only see the HTML code produced. (the result) Quote: Also, I can see some PHP (or CSS? I'm not expert) and lots of div (may I ask how many there are on a normal page?). Well PHP is dynamic code, and is totally different from CSS. CSS is only for modifying the layout and can be used with the <div> tags (which is a HTML tag), like <div style="...">. So yes, there in this code, there is a bit of...everything. If you want to make a good website, you can't pass through using HTML, PHP (or an equivalent : ASP, JSP...), a database (MySQL for example), and using CSS stylesheets. Quote: I can't even see any frame, how do you change the code to your pages? One by one? 
Frames are blahhh...You should avoid Frames as much as possible, they are old and ugly code. With PHP you can produce what we call "pseudo-frames", which are in fact a simple include() of the page you want to include, that you choose according to the parameter(s) passed through the URL. What you see here is an example of this included page, not the "whole" page. (the menu, the banner, the bottom etc...are elsewhere)
_________________ Webmaster of Animation Source, and more
|
|
| Top |
|
 |
|
woof
|
Post subject: Posted: Sun Aug 20, 2006 3:30 pm |
|
|
| Advanced |
 |
 |
Joined: Wed Aug 09, 2006 9:33 am Posts: 254 Location: here or am i over there
|
|
uuuuuuuuuuuuuuuuuhhhhhhhhhhhh
|
|
| Top |
|
 |
|
(deleted user)
|
Post subject: Posted: Tue Aug 29, 2006 3:26 pm |
|
|
|
|
How did you learn all this stuff?
|
|
| Top |
|
 |
|
Kari
|
Post subject: Posted: Thu Aug 31, 2006 7:13 pm |
|
|
| Animation Source is my home! |
 |
 |
Joined: Fri Feb 03, 2006 5:36 pm Posts: 2313 Location: Maryland
Gender: Female
|
Danman wrote: Sometimes I get this here, don´t know if i´m he only one. It doesn´t happens very often... 2 times a day, maybe 
That's weird. I haven't gotten that before, just something that says "this page cannot be displayed". When I update the page, it goes away.
_________________
 ^ click it, you know you want to 8D
I gave up everything sane a while ago.
|
|
| Top |
|
 |
|
steet
|
Post subject: Posted: Fri Sep 01, 2006 7:11 am |
|
|
| Animation Source is my home! |
 |
 |
Joined: Fri Dec 31, 2004 2:14 am Posts: 5743 Location: France
Gender: Male
|
|
It has never happened to me. I think it depends on your configuration, this is a very random thing due to the Iframe management not-always-very-good of the browsers.
_________________ Webmaster of Animation Source, and more
|
|
| Top |
|
 |
|
SilverDeni
|
Post subject: Posted: Fri Sep 01, 2006 7:33 am |
|
|
| Famous one |
 |
Joined: Sat Sep 10, 2005 1:58 am Posts: 1929
|
Hehe yes,I know these codings.
You can do them on NotePad or on Macromedia Dream waver or how
These are stuff you can be tought at school as e.g. here in Romania at Computer Science -Maths High school ,but usually they don't learn how to heck or such as I heare they learn Borland Pascal,Norton,or About IP adresses but NOT hecking.
And are some parts which you can use "logic" lol are some parts where you gotta be a geek to know and some basics as Kari's mentioned codes, isn't needfull,just knowledge.
I am NOT a PC geek but I am close enough to one  Don't wanna show off XD
_________________ People hate people that have theories about people.
|
|
| Top |
|
 |
|
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 post attachments in this forum
|
|