Web coding help please!
Moderator: Moderators
-
sam fisher
- Posts: 1093
- Joined: Mon Apr 25, 2005 8:52 am
-
bicostp
- Moderator
- Posts: 10491
- Joined: Mon Mar 07, 2005 5:47 pm
- Steam ID: bicostp
- Location: Spamalot
- Contact:
Thanks, but if I was going to do it in HTML I would not have made this thread.
Using HTML would need a seperate page for every video, and that's no good!
About the variables; would handling it as a string work? Or maybe some other scripting language?
I'll have to look and see what some other similar scrips use I guess...
About the variables; would handling it as a string work? Or maybe some other scripting language?
I'll have to look and see what some other similar scrips use I guess...
Twitter
http://www.pcwgaming.com" onclick="window.open(this.href);return false;
If you want a Dropbox account, please use my referral link
http://www.pcwgaming.com" onclick="window.open(this.href);return false;
If you want a Dropbox account, please use my referral link
-
gannon
- Moderator
- Posts: 6974
- Joined: Sun Apr 04, 2004 4:48 pm
- Location: Near that one big lake
- Contact:
I suggest making a file with the links and titles of all videos. say in the format of URL|::|TITLE .
Then you could process it into an array of links/titles with this:
Don't go on that code only though, I'm sick right now so I'm not paying too much attention to it 
Edit:
Oh yeah, you could also make the links file into an XML file. This would be even better
So, the XML file could be in a format like this:
<link>
<url>URL</url>
<title>TITLE</title>
</link>
Then you could process it into an array of links/titles with this:
Code: Select all
<?php
$contents = file_get_contents('video_links.txt');
$array = explode('|::|', explode("\n", $contents));
$links = '<ul>';
for($i=0;$i<count($array['0']);$i++) {
$links .= '<li><a href="'.$array[$i]['0'].'">'.$array[$i]['1'].'</a></li>'."\n";
}
$links .= '</ul>';
?>Edit:
Oh yeah, you could also make the links file into an XML file. This would be even better
So, the XML file could be in a format like this:
<link>
<url>URL</url>
<title>TITLE</title>
</link>
Code: Select all
<?php
$contents = file_get_contents('video_links.xml');
preg_match_all('|<link>(.*)</link>|s', $contents, $videos);
foreach($videos['1'] as $var) {
preg_match_all('|<url>(.*)</url>(.+?)<title>(.*)</title>|s', $var, $array);
}
$links = '<ul>';
for($i=0;$i<count($array['0']);$i++) {
$links .= '<li><a href="'.$array['1'][$i].'">'.$array['3'][$i].'</a></li>'."\n";
}
$links .= '</ul>';
?>-
bicostp
- Moderator
- Posts: 10491
- Joined: Mon Mar 07, 2005 5:47 pm
- Steam ID: bicostp
- Location: Spamalot
- Contact:
*shifty eyes*
*bump*
Help is still requested, please.
Since PHP doesn't like foward slashes in variables, what about a setup such as this?
<img src="http://img48.imageshack.us/img48/4012/planb8yq.gif">
Basically each movie file is on its own page, but you navigate between them with a php page. This minimizes labor for updating (Just make the html page and upload it, instead of changing every page to update the menu.)
*bump*
Help is still requested, please.
Since PHP doesn't like foward slashes in variables, what about a setup such as this?
<img src="http://img48.imageshack.us/img48/4012/planb8yq.gif">
Basically each movie file is on its own page, but you navigate between them with a php page. This minimizes labor for updating (Just make the html page and upload it, instead of changing every page to update the menu.)
Twitter
http://www.pcwgaming.com" onclick="window.open(this.href);return false;
If you want a Dropbox account, please use my referral link
http://www.pcwgaming.com" onclick="window.open(this.href);return false;
If you want a Dropbox account, please use my referral link
-
gannon
- Moderator
- Posts: 6974
- Joined: Sun Apr 04, 2004 4:48 pm
- Location: Near that one big lake
- Contact:
Actually, any character is fine in a variable as long as it's escaped. An easy way is to just tell the php processor not to go through the string to look for code, like this:
in that, the only character that needed escaping is the ' (single quote), and the \\ (double backstroke).
Code: Select all
$string = '$ / \ . " ` \' \\\\ ~';-
bicostp
- Moderator
- Posts: 10491
- Joined: Mon Mar 07, 2005 5:47 pm
- Steam ID: bicostp
- Location: Spamalot
- Contact:
So the first plan would work then?
(Sorry, you're talking to someone who knows basically nothing about PHP here!
)
(Sorry, you're talking to someone who knows basically nothing about PHP here!
Twitter
http://www.pcwgaming.com" onclick="window.open(this.href);return false;
If you want a Dropbox account, please use my referral link
http://www.pcwgaming.com" onclick="window.open(this.href);return false;
If you want a Dropbox account, please use my referral link
-
sam fisher
- Posts: 1093
- Joined: Mon Apr 25, 2005 8:52 am
-
gannon
- Moderator
- Posts: 6974
- Joined: Sun Apr 04, 2004 4:48 pm
- Location: Near that one big lake
- Contact:
The XML Data File (video_links.xml):
The PHP File:
I think you can handle editing the html portion 
Code: Select all
<?xml version="1.0"?>
<link>
<title>The Forums</title>
<url><embed src="http://benheck.com" /></url>
<description>The Forums</description>
</link>
<link>
<title>Gannon.tk</title>
<url><object src="blahblahdlhald">
</object></url>
<description>Gannon.tk</description>
</link>Code: Select all
<?php
$contents = file_get_contents('video_links.xml');
preg_match_all('|<link>(.+?)</link>|s', $contents, $videos);
$links = '<ul id="links">';
for($i=0;$i<count($videos['1']);$i++) {
preg_match('|<title>(.*)</title>(.+?)<url>(.*)</url>(.+?)<description>(.*)</description>|s', $videos['1'][$i], $array);
$files[$i] = array('url'=>$array['3'], 'title'=>$array['1'], 'desc'=>$array['5']);
$links .= '<li><a href="?id='.$i.'">'.$files[$i]['title'].'</a></li>'."\n";
}
$links .= '</ul>';
$id = isset($_GET['id']) ? $_GET['id'] : '0';
?>
<html>
<title><?php echo $files[$id]['title']; ?></title>
<head>
<style type="text/css">
body {
background-color:#EEE;
}
#main {
padding: 10px;
border: solid black 1px;
width:80%;
min-height:350px;
}
#description {
padding: 10px;
border: solid black 1px;
width:80%;
min-height:78px;
}
#links {
padding: 10px;
border: solid black 1px;
list-style: none;
position: absolute;
top: 5px;
right: 5px;
width:15%;
min-height:350px;
}
</style>
</head>
<body>
<div id="main">
<?php echo $files[$id]['url']; ?>
</div>
<br />
<div id="description">
<?php echo $files[$id]['desc']; ?>
</div>
<?php echo $links; ?>
</body>
</html>-
SpongeBuell
- Senior Member
- Posts: 5190
- Joined: Wed Apr 07, 2004 10:52 am
- Location: Colorado
- Contact:
I must have been thinking of \'s or something, I don't think I've ever said thatsam fisher wrote:I know nothing either. Just spongey told me before php variables don'l like '/'s. Oh well I guess I, and he was too!!! BLAME SPONGEY, am wrong.
Life of Brian wrote:I'll be honest with you - I would have never guessed that.RYW wrote:RYW:
Rare
Yellow
Weasel
-
bicostp
- Moderator
- Posts: 10491
- Joined: Mon Mar 07, 2005 5:47 pm
- Steam ID: bicostp
- Location: Spamalot
- Contact:
Neat! That looks a lot better than <a href="http://bicostp.portablesofdoom.org/Stuf ... html">this monstrocity</a>! 
I uploaded it <a href="http://bicostp.portablesofdoom.org/Stuf ... p">here</a>, in case anyone wants to see what all the green text does.
I changed some of the dimension code a bit to make it fit better in a smaller window on another copy (<a href="http://bicostp.portablesofdoom.org/Stuf ... layer2.php" target="_blank">Link</a>).
This is exactly what I was thinking of! Thanks
I uploaded it <a href="http://bicostp.portablesofdoom.org/Stuf ... p">here</a>, in case anyone wants to see what all the green text does.
I changed some of the dimension code a bit to make it fit better in a smaller window on another copy (<a href="http://bicostp.portablesofdoom.org/Stuf ... layer2.php" target="_blank">Link</a>).
This is exactly what I was thinking of! Thanks
Twitter
http://www.pcwgaming.com" onclick="window.open(this.href);return false;
If you want a Dropbox account, please use my referral link
http://www.pcwgaming.com" onclick="window.open(this.href);return false;
If you want a Dropbox account, please use my referral link
-
sam fisher
- Posts: 1093
- Joined: Mon Apr 25, 2005 8:52 am
