Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Server-side Scripting _ Read File

Posted by: Anette Dec 31 2020, 08:38 AM

Hello!
I want to take text from a text file and put it in to a web page.
I have an php menu, and I want to show the text in an specific "box".

So I can keep the menu and change the text only in the content, when something is pressed in the meny.
I that possible?
Can I do it with php...or ?
I can do it with a lot of php files, but I wonder if there is another way.

Grateful for all help!

Posted by: Christian J Dec 31 2020, 10:40 AM

QUOTE(Anette @ Dec 31 2020, 02:38 PM) *

Hello!
I want to take text from a text file and put it in to a web page.
I have an php menu, and I want to show the text in an specific "box".

Hello!

Not sure what you mean with "PHP menu", but that could be done with https://www.php.net/manual/en/function.include.php or https://www.php.net/manual/en/function.file-get-contents.php

QUOTE
So I can keep the menu and change the text only in the content, when something is pressed in the meny.

If you don't want to load a completely new page you'd need an IFRAME or Ajax (javascript), but I don't recommend that. It's much more reliable to load a new page.

What is the purpose of chainging the text in the content --is it to make updating the site's menu or its content easier for the site owner? The former is best done by instead including the menu from an external text file. The latter can be done with PHP, the important part is to prevent malicious users from abusing the script.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)