FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Perform maths based on a number in a text file
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Perform maths based on a number in a text file [message #183755 is a reply to message #183747] Mon, 18 November 2013 14:46 Go to previous messageGo to previous message
Ben Bacarisse is currently offline  Ben Bacarisse
Messages: 82
Registered: November 2013
Karma:
Member
drkirkby(at)gmail(dot)com writes:

> I'm tyring to simplify the design of a web site which uses PHP, and
> hope someone can help me. Basically I want to store a number in a
> file on a web site, and display that number, or a variation of it, on
> a number of web pages. Let's say the parameter is "A", and is 10
> ps. Three different web pages need to display this number, but in 3
> different ways.
>
> 1) First page shows just A
> 2) Second page multiples A by 3
> 3) Third page multiples A by -2
<snip>
> Since there will actually be 15 or so parameters, A, B, C ..., is
> there a way I can put all 15 parameters in a file (perhaps one per
> line, or with white space between them), rather than have 15 different
> files?

There is a missing piece of information. How will these numbers be
updated? If they will change because you choose to alter them, then
just put them into a PHP source file that is included in each of the
pages. They can be written as named constants or as an array indexed
in whatever way makes the accesses clearer.

If the updates are to be done by some page or other (by which I really
mean if the updates are done by some software on the server) then
putting them into a file will pay off. Personally, 15 numbers is below
the threshold I have for setting up a database, but if I did choose a
database, I'd most likely use something very simple like sqlite.

For the programmed option you don't need much more than 'split' and
'file_get_contents' ('join' and 'file_put_contents' to save).

<snip>
--
Ben.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: array search part 2
Next Topic: What do you think about this book on API ?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 01:53:41 GMT 2024

Total time taken to generate the page: 0.06031 seconds