jlhaslip
Feb 7 2006, 01:55 AM
Another Unordered List ScriptIf you remember this Script, that tutorial was about creating an un-ordered list of links from a list of files contained in a Folder which was specifically named in the script. This current Tutorial goes several steps beyond that first Tutorial by being able to create a list from several folder names and, more importantly, the script reads the list of links from a 'flat file' rather than depending on the name of the folder to be hard coded in the script. It is only one small step to have the folder names found in a mysql table, but I'll leave that aspect up to someone else. A sample is hereThis script reads a list of folder names from a text file and then builds a list of links from the filenames. The script uses the contents of the first <h3> tag as the link description and the file-name as the anchor href. The file should be an html file. This script may come in handy for creating a list of clickable links for use in sidebars and on 'sitemap' pages. Simply store html files in folders grouped by topic, ensuring that the description inside the first h3 html tag of each file is suitable for using as the display field for the anchor list. The Folder name displays as a heading for the block of links. This script is freely available for use by all who receive it. Sample page using this scriptCODE <?php print '<div id="sidebar">'; $folder_file ='flat_file_data.txt'; // name of flat file to read $fp = fopen($folder_file,'r'); // open flat file for reading if (!$fp) {print 'ERROR: Unable to open file'; echo '<br />';echo $folder_file;echo '<br />';exit;}// error if no handle found for flat file $line= fread($fp,1024); // increase this length if required $f_array=explode("\n",$line); $folder_key=0; //<!-- while loop start --> while ($f_array[$folder_key]) {; $fileCount = 0; $p_folder=strip_tags(nl2br($f_array[$folder_key])); // for security // print to begin un-ordered list using folder name as heading and as div id print '<div id="'.$p_folder.'">'; print '<b>'.$p_folder.'</b>'; $folder = $p_folder.'/'; if ($handle = opendir($folder)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $filename =$_SERVER['DOC_ROOT'].$folder.$file; $fp = fopen($filename, "r"); $contents = fread($fp, filesize($filename)); $pos1 = strpos($contents,"<h3>"); $pos2 = strpos($contents,"</h3>"); $str_length = $pos2 - $pos1; $title = substr($contents,$pos1+4,$str_length-4); $title_array[] = $title; fclose($fp); $file_array[]= $file; $fileCount++; } } } closedir($handle); if ($fileCount > 0) { $iterator = 0; while($title_array[$iterator]) { $file = substr($file_array[$iterator], 0, (strlen($file_array[$iterator]))); print '<li><a href="'.$folder.$file.'">'.$title_array[$iterator].'</a></li>'; $iterator ++; } unset($file_array); unset($title_array); } print '</div>'; $folder_key++; } //-- end while loop --> //fclose($fp); // close flat file print '</div>'; ?>
Sample File Contents:HTML <head></head> <title></title> <body> <h3>An article name</h3> </body> Sample Flat File Contents:QUOTE artfold artfold1 artfold2 ... artfoldn
Enjoy.
Reply
rvalkass
Feb 7 2006, 06:51 AM
Excellent script. I was going to write something like this myself for a website, but you've already done it, thanks
Reply
tuddy
Feb 7 2006, 01:10 PM
You've Done it again jlhaslip, nice and simple. I've been looking for something like that, and you played it right into my hands. Thanks!...
Reply
Similar Topics
Keywords : script, build, list, links, filenames, h3, tags
- [phpbb] Member Last-visit Report Script
for phpbb2 databases (0)
Background Image Swap Script
Change a Background Image based on clock time (15) Background Image Changer Script To swap the background image from your CSS file according to the
Server Clock Time. 1.) In your CSS file, add the following rule: CODE body {
background: url(time.png); } 2.) Create a "folder" named time.png. 3.) Into the
folder, place three images named morning.png, day.png, night.png. 4.) Also, in the same folder,
create an index.php file and copy/paste the following script. CODE <?php $hour =
date('H'); if ($hour < 12 ) { $image =
"morning.png"; } ....
Image Rotator Script (another One)
easy to implement (0) In case you haven't noticed, I have a different Avatar display on the Forum each time the page
is refreshed. /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif"
/> For those of you who might want the script to do that, here is the one I am using: HTML
$filesp = glob('*.png'); if(empty($filesp)){ echo
'no images found...die br >'; die(); } else{ foreach ($filesp as
$file) { $img_array[] = trim($file); }....
For ... Next Loops And Script Planning
My Fifth PHP Tutorial (2) Be sure to read the other ones. They are located in the TUTORIALS section, and at the time of this
writing all on the first page. Intro To PHP Tutorial 5 - For ... Next Loops and Planning Scripts
Released 4/15/07 By Chris Feilbach aka GhostRider Contact Info: E-mail: assembler7@gmail.com AIM:
emptybinder78 Yahoo: drunkonmarshmellows Website: http://www.ghostrider.trap17.com Before I start
talking about what wonderful things loops are and all the cool stuff they can do, I want to address
something first. I was asked about something to write in PHP. There isn't....
How To: Ip Configuration Script (win Xp)
If you travel a lot with your laptop, and need to switch between diff (0) How To: IP Configuration Script (win XP) If you travel a lot with your laptop, and need to switch
between different IP's in different locations, this script is for you. There are many programs
that handle this task very well, but they cost sometimes pretty big money. This tutorial will show
you how to make your own IP Configuration Script for free. This script is for a static ip address
configuration and is based on a little program called "NETSH.EXE" which is supplied with Windows.
How it works. QUOTE Microsoft Windows XP - Using Netsh Netsh.exe is a....
Create Professional Affiliate Links Like The Big Dogs
and save $97 like they charge for the same info! (4) Do you hate those long, ugly affiliate links such as
hxxp://www.merchant.com/buythis.cgi?affiliate=name&product=prodname&tracking=3 ? Do you hate it when
someone takes your affiliate link and cut you out, thereby "stealing" the money you could have made?
Ever wonder how the so-called "internet guru's" do it? Ever wish you had the $97 they want
so you, too, can learn how? You've probably seen such URL's as
hxxp://BigSelfProclaimedGuru.com/Recommends/CrapProduct in an email you've recieved and wanted
to duplicate it for your own affilate programs. W....
Php Script To Make A Link List
From the list of the Directory Files (6) Well, it has been a while since I have added anything to the Tutorial Sectiion, so here is another
script for the members to enjoy. This one creates a list of links from the contents of the directory
which it is run from. For instance, if you run it from the public_html folder, then all the files
(not the Directores) are listed and linked so when you click on the link, that file is parsed and
output to the browser. Here is the code: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
An XHTML 1.0 Strict Page to List the files in this directory ....
Custom Bbcode Tags In Smf
adding extra tags in a Simple Machines Forum (0) Adding custom BBCodes to your Simple Machines Forum is really very... simple. First, you will need
to download three mods from the package manager. Faster Parsecode, ModSettings Textarea, and of
course Custom BB Code. Once you have those mods set up you will need to go into your admin section
and click on your "Edit Features and Options" link. In the Basic Forum Features section you will now
find a "Custom BB Code tags" box. This box is where you will put your custom codes. You can add as
many as you like, one per line. Let's break down the bits of a simple tag tha....
Php Menu Bulding Script And Site Template
available for download (0) A Php Menu-builder Tutorial This Sidebar Menu-builder code and the php scripts are adapted from
a Tutorial on the Astahost.com Forum titled : CMS101 - Content Management System Design .
Since the original tutorial's author (vujsa) did such a marvellous job of describing the system
in the original Topic posting, I will not attempt to explain it here, rather, I invite you to have a
look at his Topic and learn from it. The Basic tutorial provided coding for developing a table-based
web-site template which used php includes and embedded data to create a &....
Page Generation Time Script
A script to tell how long it took to generate (17) this is a script used to tell you or visitors how fast your page was generated for the person who is
viewing it... Ok it is verry simple!! all you have to do is put this script on every
page... that you want it to be on CODE <?php $starttime = explode(' ',
microtime()); $starttime = $starttime[1] + $starttime[0];
?> and put it before everything on the page, for me i put it right underneith the DOCTYPE
script which i think is a bloody waste of space to have it on there, but anyways.. ....
Verifying Email Addresses
Using a simple PHP script (8) This simple script will allow you to run some basic checks to make sure that any email address
entered is actually an email address. There is no guarantee offered that this will stop every single
fake email address, but it'll provide some protection. Now, the code! First we need to get
the email address to verify. Here, I get it using POST from an HTML form. CODE <?php //Load
email address from web form $email = $_POST['email']; Now, we move on
to our first check. Does the text that has been entered look like it could b....
Installing Ndstats!
The greatest Stats script of all time. (4) An example of this script cna be found at http://www.own.tc/ (click enter) This is by far the
BEST stats script and most sites use it! This is a PHP script and requires you to include files
(Please... don't do iframes!) DOWNLOAD LINK: GO TO www.ZYMIC.com and go to Php scripts>stats
scripts> and the current version of NDSTATS. Downlaod it and unzip it! Go to your WWW directory
and create a folder called "ndstats". Then what you need to do is upload all of your files into
that folder. You all should know how to do that. Then go to the top of the pag....
Random Quote Script
(6) Here's a little random quote script that you can use to randomly choose from an array of quotes
you provide. It's very easy to use on any page as it's an external script, you just call it
from your page. I wouldn't use it for any more than about 50 quotes though, it would probably
slow your site down too much. Here's the code: var ar = new Array(44) ar = "Do not meddle in
the affairs of wizards, for they are subtle and quick to anger." ar = "Faithless is he that says
farewell when the road darkens." ar = "I cordially dislike allegory in all its ....
How To Use Trap17 Cgi Formmail
a built-in script in every hosting (15) This tutorial is using TRAP17 hosting's built-in script called cgiemail. There are several
hundreds of free scripts you can download and install it yourself but why not use what is already
provided for you, if all you need is a simple submit and data collection? Let's begin. There
are three things you need to remember: 1) you can rename the file however you'd like 2) two
files (which I'll name them submitForm.html and template.txt ) must be in the same directory
3) first two lines in template.txt must EXIST. Write your submitForm.html (where you ....
[php] Simple Newsletter Script
(8) This tutorial will give you the code needed and tell you how to implement it. First off you need to
create a file called mailing.php this will be the file that processes the adding of emails to the
list. CODE <?php $email = $_POST['email']; $file =
fopen("mailing.txt", "a"); fwrite($file, "\n" .
$email); fclose($file); header("Location:
mailing_thankyou.php"); ?> Next you need to create a file called
mailing_thankyou.php , simple a p....
Secure The Email Addresses On Your Website!
Wonderful script and useful! And working (10) Just follow the instructions below: /* Secure Email Function by Juan Karlo Aquino de
Guzman Website: http://www.karlo.ph.tc and http://www.abs-cbn.ph.tc E-mail:
http://www.karlo.ph.tc/send.php Usage: showEmail("support@microsoft.com",0); OR
showEmail("support@microsoft.com",1); Types: 0 = ordinary random 1 = more secure random To
include to a script: include_once("email_secure.php"); */ And here is the code :
CODE <?php /* Secure Email Function by Juan Karlo Aquino de Guzman Website:
http://www.karlo.....
E-mail Mailer Script 0.1
useful for website visitors (4) Are you pissed off when you are putting e-mail in your website, you always get spammers? Well,
here's the solution. Just change the default variables to anything that you like, etc... follow
the instructions on the script.. Here it is... hope you like it /smile.gif' border='0'
style='vertical-align:middle' alt='smile.gif' /> CODE <?php //E-mail Mailer Script 0.1
by Juan Karlo de Guzman //FOR TRAP17 ONLY... DEMO VERSION... DO NOT DISTRIBUTE
header("Content-type: text/html; CHARSET=UTF-8");
$int_rand=mt_rand(1,20); if....
Simple Php Counter Script
How to make a simple php counter script (2) In this tutorial i will explain how to make a simple script writen in PHP...that uses .txt file.
CODE <?php // script writen by tema $a = fopen ("count.txt",
"r"); // 1. $bytes = 4; $x = fread($a, $bytes); //
2. $y=$x + 1; // 3. $fp = fopen ("counter/count.txt",
"w+"); // 4. fwrite ($fp, "$y"); // 5. fclose
($fp); // 6. echo "Posjeta:$y"; // 7.
?>....
Saint-michael Html Tips And Tricks Issue #3
exploring meta tags and what uses they have (0) Todays issue we are going to talk about a bunch of good newbie stuff. The first is meta tags to
make it easy use a generator, from my searches on the internet ther are soe many meta tags to use
its not even funny but for those whoe like them is are the more common ones that are used for a
website. QUOTE also for a dynamic look using the meta this called page
fading so to speak, what it does when you click on a link the website will fade for a duration of
time to the next page on your site warning it doesn't do anything when you first cl....
Email Script/form With Php
how to make a simple email script using php (35) Today, I'm going to show you how to make an email script using PHP and HTML. Most people usually
put Email me if they want an email link on their site, but there are several cons to this.
First, it's very inconvenient for those people who use web-based mail such as Yahoo!,
Hotmail, or Gmail because that darn Micro$oft Outlook program comes up if one accidently click
the link. Second, you are very suseptible to spam bots because they scan your HTML source code for
anything with the same pattern as an email address and add it to their database. If yo....
Roll-over Image Links With Css
No preloading of images (2) Here is a way of having roll over image links without preloading images by using CSS and a table.
It's very useful for a list of links as in a side bar menu or header. It also solves not having
to make a seperate image for each different link by placing the desired text over the image. 1.
First you need an image which comprises of the main link image, the 'mouse over' image link
underneath plus you can have another for visited links. As for most roll over images, the images
should be the same size. The above example - button.gif is 100x60px with each lin....
Howto#1: Custom Bbcodes On Ipb
The inner workings of the CONSOLE & HIGHLIGHT Tags (0) Custom BBCodes for Forums -------------------------- Hi all, I came up with this article to share
what I learnt of designing Custom BBCodes for various forum softwares while trying to come up with
some useful one's for AstaHost. Most of you are by now familiar with the new ones like CONSOLE,
NOTE, TABL etc. which I introduced a few days back. So how do these BBCodes work ? And how does the
forum softwares parse them. BBCodes, as you know, usually takes a Text Stuff format. The
"Text Stuff" in the textual content on which you want your bbcode to work. I....
Php Guessing Script
Script game.. (4) Here's the guessing script, they guess a number and checks if they are right or wrong.. CODE
<form method="guess.php?action=yes"> <input type="text"
name="t_guess"> <br> <input type="submit" value="Guess">
<?php if($action==yes){ //have the number that they are suppose to guess...
$guess=14; //end if($t_guess==$guess){ print "Good job! Guess was
right!"; }else{ print "Guess was wrong! Try again!"; } } ?> Tha....
HTML tags and examples
Condensed form of course from my site... (37) Well, I decided to try and help out some of the users here who might be unexperienced in HTML, so I
condensed the begginer's HTML course at my website. Here it is... Lesson 1 HTML means Hyper
Text Markup Language. HTML is a very common language used for many websites, is the base for more
complicated and powerful langauges like php, HTML can seem hard, but you will find it is one of the
easiest langauges one can learn. The core of HTML is the tag, a tage is just a set of two
arrows-like brackets created by hitting Shift and the comma key, or Shift and the period....
Php Quiz Script
Make quizzes for your site. (20) Hello all, A little bit back I decided to make a quiz scriptjust out of no where lol. However it
doesnt do anything special but I am going to make an email mod for it so that it will email results
to your email address. So here is the basis of it. INSTRUCTIONS: Open a new page in your text
editor and paste in the following code. CODE <?php $qid = "Quiz ID-00"; ?>
<html> <head> <title><? echo "Gamers Pub $qid";
?></title> </head> <body> <p><h3><? echo "....
Mail Form (php)
This is a great email form script. (3) save this page as formmail.php Code: QUOTE $MailTo = "your email"; $MailSubject
= "contact"; $MailHeader = "From: $s1"; $MailSent = "Put here the information you
want to be shown after the message is sent."; if ($s1 == ""){ echo "You did not put your
name ."; } else { $MailBody = "Name : $s1\n"; } if ($s2 == ""){ echo "You did
not put your E-Mail ."; } else { $MailBody .= "Email : $s2\n"; } if ($s3 ==
""){ } else { $MailBody .= "Message : $s3\n"; } { mail($MailTo....
Multiple Admin Login (php)
This is a script that doesnt requre SQL (3) first off make a login.html page Code: QUOTE Admin Login Username: Password:
then make a check.php page Code: QUOTE $admin1 = "admin1"; //
first admin username $adm_pass1 = "password1"; // first admin password $admin2 =
"admin2"; // second admin username $adm_pass2 = "password2"; // second admin password
if(($username == $admin1 && $password == $adm_pass1) || ($username ==
$admin2 && $password == $adm_pass2)){ echo "Congratulations " . $_POST . " ....
A Complete Guide To Anchor Tags
guide to anchor tags (6) Here are some things you can do with anchor tags: ************* To link the another website:
************** To link to another webpage on your website: Takes you to example.html in the
same directory that you are in. The / after your first speech mark takes you to your first
directory. It then says to take you example.html which is in directory example!
*************** OK this looks a bit tricky but it's effective: What it does is when you
place your mouse over the link, the status bar - the bar which usually says Done when a page....
Security Programs And Links
(2) I written this security advice for many support services/Forums so i decided to post a copy for
Trap17 too.Well Choosing security software what's in that?Just install antivirus/firewall,keep
it updated and Relax.No this will not help you at all.So in this Tutorial what i am going to cover
is Security software (Antivirus & Firewalls Encryption software, Few utilities).At last i will
also tell you what to do to avoid virus infecting from your PC. First Lets start with encryption
software why we need it?Encryption software converts your data into secret code & to co....
Looking for script, build, list, links, filenames, h3, tags
|
|
Searching Video's for script, build, list, links, filenames, h3, tags
|
advertisement
|
|