Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #11820
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Perform maths based on a number in a text file |
| Date | 2013-11-18 13:19 +0000 |
| Organization | albasani.net |
| Message-ID | <l6d45m$67d$1@news.albasani.net> (permalink) |
| References | <83ddeb0e-5749-4602-bda0-e9d6770feb44@googlegroups.com> |
On 18/11/13 09:23, drkirkby@gmail.com wrote: > 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 > > So if A was 10 > > 1) Page 1 should show 10 2) Page 2 should show 30 3) Page 3 should > show -20. > > If the value of A changes, I'd like to update the web site in one > place, and not go around to every page updating them individually, as > that will be error prone. > > Is there a way to put the value of A in a text file, and use the > value in different parts of the site? If so how? > yes. > 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? > yes. Or a database table. Rather than a file. > If you look at this web page which is for an economimcal / low cost > vector network analyzer kit, > > http://www.vnacalibration.co.uk/support/85033/Rohde+Schwarz/ > > you can see the numeric values in the form used by Rohde & Schwarz > for their vector network analyzers, whereas in this page which is a > bit longer, under the section "Standard Definitions", > > http://www.vnacalibration.co.uk/support/85033/HP/ > > one has basicaly the same parameters, but expressed in a different > way. Another make of vector network analyzer wants the parameters in > a different way. > > Any thoughts? > This is not a big problem intrinsically, but the implementation detail is where the work would be. I would strongly recommend using a database: setting that up is a bit of a faff, but once set up it provides the sort of 'update by one screen, read buy many others' sort of access that you need. And wont need any file level parsing - you will get your numbers as an array from a Mysql type query. You can even embed the mathematics in the query instead of doing it on PHP, if you want. But all this assumes you are willing to knuckle down and learn basic SQL, mysql administration, and how to set up web forms and the like. If you are as you sound, a relative newcomer, this is a few weeks work :-( However it's an ideal problem to cut your teeth on. :-) > Dave > -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Perform maths based on a number in a text file drkirkby@gmail.com - 2013-11-18 01:23 -0800
Re: Perform maths based on a number in a text file Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-11-18 11:57 +0100
Re: Perform maths based on a number in a text file The Natural Philosopher <tnp@invalid.invalid> - 2013-11-18 13:19 +0000
Re: Perform maths based on a number in a text file Tim Streater <timstreater@greenbee.net> - 2013-11-18 15:08 +0000
Re: Perform maths based on a number in a text file The Natural Philosopher <tnp@invalid.invalid> - 2013-11-18 16:22 +0000
Re: Perform maths based on a number in a text file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-11-18 16:50 +0000
Re: Perform maths based on a number in a text file Tim Streater <timstreater@greenbee.net> - 2013-11-18 16:53 +0000
Re: Perform maths based on a number in a text file drkirkby@gmail.com - 2013-11-20 03:50 -0800
Re: Perform maths based on a number in a text file David Robley <me@home.invalid> - 2013-11-20 22:32 +1030
Re: Perform maths based on a number in a text file The Natural Philosopher <tnp@invalid.invalid> - 2013-11-20 13:03 +0000
Re: Perform maths based on a number in a text file Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-20 11:20 -0500
Re: Perform maths based on a number in a text file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-11-18 14:46 +0000
Re: Perform maths based on a number in a text file drkirkby@gmail.com - 2013-11-20 03:53 -0800
Re: Perform maths based on a number in a text file Jerry Stuckle <jstucklex@attglobal.net> - 2013-11-18 11:38 -0500
Re: Perform maths based on a number in a text file drkirkby@gmail.com - 2013-11-20 03:58 -0800
Re: Perform maths based on a number in a text file Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-21 03:10 +0000
csiph-web