Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
quick navigation script help please.
Old 12-22-2010, 03:46 PM quick navigation script help please.
Skilled Talker

Posts: 77
Name: adam
Location: UK
Trades: 0
Hey I want to make a site that uses static html pages but I want the navigation to be dynamic. Just wondering if their is a way to find all the html pages in a directory then output links pointing to those pages.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
mintuz is offline
Reply With Quote
View Public Profile Visit mintuz's homepage!
 
 
Register now for full access!
Old 12-22-2010, 04:02 PM Re: quick navigation script help please.
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
PHP Code:
function get_links($dirPath$dirURL$extensions)
{
    
$dir = new DirectoryIterator($dirPath);
    
$links = array();
    
    foreach(
$dir as $file)
    {
        if(
$file->isFile())
        {
            
$name $file->getFilename();
            
$ext substr(strrchr($name'.'), 1);
    
            if(
in_array($ext$extensions))
                
$links[] = $dirURL $name;
        }
    }

    return 
$links;
}

//example
$links get_links('./dir''http://example.com/dir/', array('html''htm')); 
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to quick navigation script help please.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24135 seconds with 12 queries