/    Sign up×
Community /Pin to ProfileBookmark

hi all im trying to make a website for my teacher and she dont know any html so i had the idea of linking to text files so it would be easy for her to update in future.

Im finding somthing dificult tho and not knowing mutch about PHP im strugling, there is a links page on the site im building her.

So My question is
how can i make the following text read everything in the text file and display it as a clickable hyperlink

[CODE]<ol>
<li><em><?php
readfile(“text/links/links.txt”);
?>
</a></em></li>
</ol>
[/CODE]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@Dave_LaneJul 09.2009 — Are you looking for something like this?

[CODE]
<?php $content = file_read_contents( "text/links/links.txt" ); ?>
<a href="<?php echo $content; ?>"><?php echo $content; ?></a>
[/CODE]


Or this?

[CODE]
<ol>
<?php
$file = fopen( "text/links/links.txt" );
if( $file ){
while( !feof( $file ) ){
$link = fgets( $file );
echo "<li><a href="$link">$link</a></li>";
}
}
?>
</ol>
[/CODE]
×

Success!

Help @nay27uk spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...