...

View Full Version : Source file?



njfail
11-10-2010, 05:37 AM
Is it possible to link to an html file like its a source file for data?

What I mean is, lets say I have a list of links that I want to put on 20 different pages. Can I write the list once, and then have each of the 20 pages read the 1 list file? That way I could edit the 1 list file, instead of having to update each of the 20 pages.

Also, is it possible to create a form that people submit and updates a list automatically?

teedoff
11-10-2010, 02:37 PM
Its called server-side includes. If your hosting site supports Coldfusion or php or even SSI, then you can do this. You woul create a separate file with nothing but the list of links, then in any pages you wanted to include the lists, add a single line of code to include them.

Read about them here (http://www.w3schools.com)and here (http://www.alistapart.com).

njfail
11-10-2010, 06:55 PM
Ah yes, I use JustHost.com, and they support PHP.

Is php hard to learn?

I've learned a lot of html and css and the basic concepts behind them from just browsing the web and experimenting with it. Is PHP harder than html/css ? When I look at some of the default php folders on the server they're all crazy characters and I'm just like uhh...

teedoff
11-10-2010, 07:14 PM
I think its hard, but if you just want a php include thats simple


Create the page with your lists however you want them displayed..if its just a list of links then use an unordered list. You can style the list later with css. You dont need any think on this page other than the list. No doctype no body or html tags.

Then whereever you want the list to be included in your html page...that would need to changed to a .php file, use the foloowing line:


<?php include("mylistFilename.php"); ?>


Thats pretty much all there is.

njfail
11-10-2010, 07:43 PM
Thanks!

I actually want it to be a list of videos, which will be embeded with youtube code.

Would this still be the same?

teedoff
11-10-2010, 07:46 PM
A list is a list...should be.

njfail
11-10-2010, 08:36 PM
so I name the list file: list.php ?

Put this in the list.php file:

<ul>
<youtube embeded code here>
<youtube embeded code here>
</ul>

then I put


<?php include("mylistFilename.php"); ?>

In the html file where I want the list to show up?

teedoff
11-10-2010, 08:44 PM
so I name the list file: list.php ?

Put this in the list.php file:

<ul>
<youtube embeded code here>
<youtube embeded code here>
</ul>

then I put


<?php include("mylistFilename.php"); ?>

In the html file where I want the list to show up?


This:

<?php include("mylistFilename.php"); ?>
Would become this:

<?php include("list.php"); ?>

And your html file would need to be changed to a php file....index.html would become index.php

njfail
11-10-2010, 09:10 PM
oh alright, thanks for all the help :)

would it cause any problems with any browsers or google crawlers having html inside of the php file?

Because I know people warned me that google doesn't like inline CSS inside html files.

teedoff
11-10-2010, 09:16 PM
oh alright, thanks for all the help :)

would it cause any problems with any browsers or google crawlers having html inside of the php file?

Because I know people warned me that google doesn't like inline CSS inside html files.

You're talking about different things. CSS is a way to style your html pages. And ideally yes all styles should be at least in the head section if not in another style sheet and called by a link.

PHP is a server side language used quite often for accessing databases and displaying records from the database.

njfail
11-11-2010, 04:27 AM
Ok, so I ran into another snag.

I want to have 2 options/buttons.
option 2 shows the best videos list.
option 1 shows the most recent videos list.

On default it should show option 1.
But users should be able to click the button for option 2.


Is there a way to have it use the php code you showed me, but change it if the person presses the 2nd button img?

so I would have 2 source lists, and button 1 makes it use source list1, button 2 makes it use source list 2

njfail
11-11-2010, 04:44 AM
ahh, when I try to do this, I get an error.

The page I was experimenting with it is @ njfail.com/solo

created index.php
created listpam.php

put some youtube videos inside the listpam.php file.
put the code into the index.php file.

this comes up in an error log file in my directory folder:


[10-Nov-2010 22:39:17] PHP Warning: include(/solo/listpam.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/njfailc1/public_html/solo/index.php on line 64
[10-Nov-2010 22:39:20] PHP Warning: include() [<a href='function.include'>function.include</a>]: Failed opening '/solo/listpam.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/njfailc1/public_html/solo/index.php on line 64

This is the index.php code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<LINK REL=StyleSheet HREF="/njstyle.css" TYPE="text/css" MEDIA=screen>
<link rel="stylesheet" href="/menu/menu_style.css" type="text/css" />
<title>Starcraft II Gaming Community</title>
<meta name="Copyright" content="&copy; 2010 NJFAIL">
<meta http-equiv="Content-Language" content="EN-US">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Description" content="NJFAIL is a community site focused on Starcraft II, featuring pro-gaming news and information, videos, strategy, and replays, casts, and the latest info from Blizzard.">
<meta name="keywords" content="Starcraft II, starcraft 2, sc2, wc3, warcraft, blizzard, best rts, computer game, tournaments, tournaments with prizes, gosu, pro replays, real time strategy, videogame, gaming community, clan, league, guild, terran, zerg, protoss, starcraft, clan wars" />
</head>
<body>
<div id="pagewidth" class="clearfix">
<div id="container">
<div id="header1">
<img src="http://www.njfail.com/njfail_images/njfail_banner.JPG">
</div>
<div id="header2">
<!-- Begin: AdBrite, Generated: 2010-08-16 3:01:26 -->
<script type="text/javascript">
var AdBrite_Title_Color = '0033FF';
var AdBrite_Text_Color = '0099FF';
var AdBrite_Background_Color = '000000';
var AdBrite_Border_Color = '000000';
var AdBrite_URL_Color = '0033FF';
try{var AdBrite_Iframe=window.top!=window.self?2:1;var AdBrite_Referrer=document.referrer==''?document.location:document.referrer;AdBrite_Referrer=encodeUR IComponent(AdBrite_Referrer);}catch(e){var AdBrite_Iframe='';var AdBrite_Referrer='';}
</script>
<span style="white-space:nowrap;"><script type="text/javascript">document.write(String.fromCharCode(60,83,67,82,73,80,84));document.write(' src="http://ads.adbrite.com/mb/text_group.php?sid=1700638&zs=3732385f3930&ifr='+AdBrite_Iframe+'&ref='+AdBrite_Referrer+'" type="text/javascript">');document.write(String.fromCharCode(60,47,83,67,82,73,80,84,62));</script>
<a target="_top" href="http://www.adbrite.com/mb/commerce/purchase_form.php?opid=1700638&afsid=1"><img src="http://files.adbrite.com/mb/images/adbrite-your-ad-here-leaderboard-w.gif" style="background-color:#000000;border:none;padding:0;margin:0;" alt="Your Ad Here" width="14" height="90" border="0" /></a></span>
<!-- End: AdBrite -->
</div>
<div id="header3">
<ul id="menu">
<li><a href="http://www.njfail.com/" target="_self">Home</a></li>
<li><a href="forums" target="_self">Forums</a></li>
<li><a href="http://njfail.com/Forums/viewforum.php?f=15" target="_self">Tournaments</a></li>
<li><a href="/replays" target="_self">Replays</a></li>
<li><a href="pro.html" target="_self">NJFAIL Pro</a></li>
</ul>
</div>
<div id="leftcol">

<img src="http://www.njfail.com/njfail_images/ic20ad.jpg">

<br />

<!-- Begin: AdBrite, Generated: 2010-08-14 18:41:20 -->
<script type="text/javascript">
var AdBrite_Title_Color = '0033FF';
var AdBrite_Text_Color = '0099FF';
var AdBrite_Background_Color = '000000';
var AdBrite_Border_Color = '000000';
var AdBrite_URL_Color = '0033FF';
try{var AdBrite_Iframe=window.top!=window.self?2:1;var AdBrite_Referrer=document.referrer==''?document.location:document.referrer;AdBrite_Referrer=encodeUR IComponent(AdBrite_Referrer);}catch(e){var AdBrite_Iframe='';var AdBrite_Referrer='';}
</script>
<script type="text/javascript">document.write(String.fromCharCode(60,83,67,82,73,80,84));document.write(' src="http://ads.adbrite.com/mb/text_group.php?sid=1729706&zs=3330305f323530&ifr='+AdBrite_Iframe+'&ref='+AdBrite_Referrer+'" type="text/javascript">');document.write(String.fromCharCode(60,47,83,67,82,73,80,84,62));</script>
<div><a target="_top" href="http://www.adbrite.com/mb/commerce/purchase_form.php?opid=1729706&afsid=1" style="font-weight:bold;font-family:Arial;font-size:13px;">Your Ad Here</a></div>
<!-- End: AdBrite -->
</div>

<div id="maincol">
<?php include("/solo/listpam.php"); ?>
<br />

<form name="input" action="/solo/listpam.php" method="post">
B.net Username: <input type="text" name="user" />
Char Code #: <input type="text" name="cc#" />
<input type="submit" value="Submit" />
</form>

</div>

<div id="rightcol">
<br />
<a href="http://www.adbrite.com/mb/landing_both.php?spid=139521&afb=120x60-1-blue">
<img src="http://files.adbrite.com/mb/images/120x60-1-blue.gif" border="0"></a>
<br />
<!-- Begin: AdBrite, Generated: 2010-08-14 19:00:26 -->
<script type="text/javascript">
var AdBrite_Title_Color = '0033FF';
var AdBrite_Text_Color = '0099FF';
var AdBrite_Background_Color = '000000';
var AdBrite_Border_Color = '000000';
var AdBrite_URL_Color = '0033FF';
try{var AdBrite_Iframe=window.top!=window.self?2:1;var AdBrite_Referrer=document.referrer==''?document.location:document.referrer;AdBrite_Referrer=encodeUR IComponent(AdBrite_Referrer);}catch(e){var AdBrite_Iframe='';var AdBrite_Referrer='';}
</script>
<script type="text/javascript">document.write(String.fromCharCode(60,83,67,82,73,80,84));document.write(' src="http://ads.adbrite.com/mb/text_group.php?sid=1729713&zs=3132305f363030&ifr='+AdBrite_Iframe+'&ref='+AdBrite_Referrer+'" type="text/javascript">');document.write(String.fromCharCode(60,47,83,67,82,73,80,84,62));</script>
<div><a target="_top" href="http://www.adbrite.com/mb/commerce/purchase_form.php?opid=1729713&afsid=1" style="font-weight:bold;font-family:Arial;font-size:13px;">Your Ad Here</a></div>
<!-- End: AdBrite -->
</div>
</div>
<div id="footer">
<div id="footermenu">
<ul>
<a href="sitemap.html">Site Map</a>
&nbsp;&nbsp;&nbsp;
<a href="privacypolicy.html">Privacy Policy</a>
&nbsp;&nbsp;&nbsp;
<a href="tournamentpolicy.html">Tournament Policy</a>
&nbsp;&nbsp;&nbsp;
<a href="contact.html">Contact Us</a>
</ul>
</div>
</div>
</div>
</body>
</html>

this is the listpam.php code:

<ul>
<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/AJOt5x5x8z8?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/AJOt5x5x8z8?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>
<br />
<br />
<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/nLMZkaoywoY?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/nLMZkaoywoY?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object>
</ul>


This is on the page itself:

Warning: include(/solo/listpam.php) [function.include]: failed to open stream: No such file or directory in /home/njfailc1/public_html/solo/index.php on line 64

Warning: include() [function.include]: Failed opening '/solo/listpam.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/njfailc1/public_html/solo/index.php on line 64



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum