File Manipulation Code
  Home arrow File Manipulation Code arrow Document Auto Linker And Display
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
FILE MANIPULATION CODE

Document Auto Linker And Display
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2002-01-18

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    This script will auto link any text file in table manners in selected directory, and auto link them. Great for website like Olga, lyrics and tabs

    By : jiwang

    You will need two files linker.php and disp.php
    The reason i created this script is that i have over 300
    tabs and lyrics in text format. It would be silly and time consuming to link it all. Try it out.

    linker.php ( this page is to autolink textfiles in your directory)
    -------------
    <table border="1" bordercolor="#000000" align="center" WIDTH="75%"><tr
    bgcolor="#999999"><td><font
    color="#000000">Name</font></td><td><font color="#000000">Size</font></td></tr>

    <?php

    exec("ls -la $dir",$lines,$rc);
    $count = count($lines) - 1;
    for ($i = 1; $i <= $count; $i++) {
    $type = substr($lines[$i],0,1);
    $name = strrchr($lines[$i]," ");
    $name = substr($name,1);
    $dire = substr($lines[$i],0,strpos($lines[$i],$name));

    // echo "$dire</font>"; //
    if ($type == "d") {
    if ($name == "." or $name == "..") {
    ;
    } else {
    if ($dir == "") {
    $size=filesize($name);
    echo "<tr bgcolor=\"#999999\"><td><a href=\"$name\">$name</a></td><td>$size</td></tr>";
    } else {
    $size=filesize($name);
    echo "<tr bgcolor=\"#DDDDDD\"><td><a href=$dir/disp?i=$name>$name</a></td><td>$size</td></tr>";
    }
    }
    } else {
    if ($dir == "") {
    $size=filesize($name);
    echo "<tr bgcolor=\"#999999\"><td><a href=disp.php?i=$name>$name</a></td><td>$size</td></tr>";
    } else {
    echo "<tr bgcolor=\"#DDDDDD\"><td><a href=$dir/?i=$name>$name</a></td></tr>";
    }
    }
    }
    ?>

    </table><br>

    disp.php (this page is to display the textfiles in tableized manner)
    -----------------
    <?php

    $text_dir="/usr/home/jiwang/public_html/test"; //the file path of your textfile
    $text_url="http://www.jiwang.org/test"; //this is the url of your directory

    //change this below if you so desire...
    ?>

    <center><table BORDER CELLSPACING=0 CELLPADDING=5 COLS=1 WIDTH="75%" BGCOLOR="#999999"
    bordercolor="#000000">
    <tr>
    <td><pre>
    <?php

    //of course you can add errors to this script. this will display them...
    function error($what) {
    echo "<u>doc error...</u><p>\n";
    echo $what;
    exit;
    }

    if(!$i) {
    echo "<title>docs</title>\n</head><table><form action=$PHP_SELF><tr><td valign=top>docs: <input type=text name=i></td><td valign=top><input type=submit value=submit></form></td></tr></table>\n";
    exit;
    }

    else {$i=addslashes($i); echo "<title>documents - $i</title>\n</head>\n";}

    $file=$text_dir."/".$i; $url=$text_url."/".$i;

    if(is_file($file)) {

    include ("$file");

    }

    else {error('file does not exist');}

    ?>

    </pre>
    </td>
    </tr>
    </table></center>

    ------------------------
    YOu can include linker.php in disp.php to include the menu.
    YOu can also call the text file manually
    http://yourdomain.com/text/disp.php?i=file.txt

    Good luck!
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More File Manipulation Code Articles
    More By Codewalkers

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Achieving True Agility -- How process can change the behavior of your tools

    Achieving true agility is a never-ending effort. We will showcase how you can become agile incrementally, a few practices at the time.Which practices should any agile team strive to adopt? What additional practices should you consider based on your needs to scale? Adopting practices are however made much easier with the right tool support. What about if your tools adapt to your practices? We will take a look at how the Jazz technology can be leveraged to make your process change the behavior of your tools.
    FREE! Go There Now!


    NEW! Discovering the value of WebSphere Process Server

    WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies.
    FREE! Go There Now!


    NEW! Don't wait! Try the Rational Application Developer (RAD) v7.5 open beta code today

    Download the Rational Application Developer (RAD) v7.5 open beta code and start developing applications for the JEE5 standard which features EJB3.0, JPA, JSF 1.2, JSP 2.1 and Servlet 2.5 standards. When you use this beta you will see how you can increase developer productivity for already existing applications with improved support for refactoring, as well as adding new features to existing applications. In addition, the beta provides tooling for JD Edwards, Oracle, SAP, Siebel and PeopleSoft to improve the developer productivity with these enterprise systems.
    FREE! Go There Now!


    NEW! Evaluate Rational Business Developer V7.1

    Visit IBM developerWorks to download a free trial version of IBM Rational Business Developer V7.1. Rational Business Developer offers rapid and simplified development of business applications and services through Enterprise Generation Language (EGL) tools, generating Java or mainframe solutions while shielding developers from technical complexities.
    FREE! Go There Now!


    NEW! Evaluate WebSphere Extended Deployment Compute Grid V6.1

    Visit IBM developerWorks to download a free trial version of WebSphere Extended Deployment Compute Grid, which lets you schedule, execute, and monitor batch jobs. Because online transaction processing and batch jobs execute simultaneously on the same server resources, you can avoid costly duplication of resources. Compute Grid supports job types of Java transactional batch, compute-intensive and a new type called "native execution", which enables non-Java workloads to run on distributed end points.
    FREE! Go There Now!


    NEW! Harnessing the power of SQL and Java for high performance data access

    Join this webcast to see how IBM Data Studio Developer and pureQuery can take the pain out of Java data access. uApplications developed using both Java and SQL have become a common requirement. Database connectivity using Java Database Connectivity (JDBC) to create an application is a multi-step tedious process, and tooling that covers both SQL and Java has been unavailable, until now. IBM Data Studio introduces the pureQuery platform: a high-performance, Java data access platform focused on simplifying the tasks of developing, managing, and optimizing database applications and services.
    FREE! Go There Now!


    NEW! Hello World: Monitor a simple business process using WebSphere Business Monitor V6.0.2

    This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product.
    FREE! Go There Now!


    NEW! IBM Rational Systems Development e-Kit

    As systems increase in complexity, communication between systems and software teams becomes more and more difficult. Now, there’s a way to improve product quality and communication.<br />Read the “Model Driven Systems Development” white paper to see how. Also included in this kit are more educational white papers, customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems.<br />
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for People

    Visit IBM developerWorks to try the IBM SOA Sandbox for people. The SOA Sandbox for people provides a trial environment with the necessary tooling and components required to enable consistent human and process interaction and collaboration, showing how you can improve user experience and business productivity.
    FREE! Go There Now!


    NEW! Webcast: Introducing the new Information Server and Solutions community: LeverageInformation

    User communities play an important role in communication and collaboration around products, solutions and other areas of special interest to members. Successful communities are able to provide the right mix of content and services to deliver a value proposition that resonates with each audience. Join Tom Inman, VP of Marketing for Information and Platform Solutions as he introduces the new LeverageINFORMATION community. During this webcast, learn about the value provided by the community and how customers and partners derive value from the community in addressing their own technical and business challenges.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    FILE MANIPULATION CODE ARTICLES

    - Bandwidth Control with pure PHP
    - Eazy Gallery
    - file_get_contents for PHP < 4.3.0
    - PHP Class: Image Snapshot 1.3
    - Universal downloader
    - Image Gallery v2.0
    - Free/Used Disk Space
    - Directory Lister
    - Directory image view, with selective hidden
    - Move or Copy a Directory (and files and sub ...
    - Ensure_Sub_Directory_Exists
    - Wedit
    - Form Examples Text Boxes to Drop Downs
    - myFiles
    - List files in a directory, no subdirectories





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek