Page 1 of 1
2 stations on same site
Posted: Thu 28 Jul 2011 2:44 pm
by Per69
Hej
Is it possible to send 2 cumuluswebtags.php to the same page.
As instructed in the top of coding you should have <?php
require_once("cumuluswebtags.php");?>
Can you stop the first php file after som rows and then continue with the other php file.
Should I rename the file so I have 2 different names?
/Per
Re: 2 stations on same site
Posted: Fri 29 Jul 2011 1:02 am
by gemini06720
Per, I do not think a file with the same name can be uploaded (FTP) to a host server without one overwriting the other one - you would need for each file to have its one name.
Could you please be a bit more informative as to what you are trying to accomplish...
Even the title to this thread is a bit confusing...
Re: 2 stations on same site
Posted: Fri 29 Jul 2011 8:04 am
by Per69
Hej
I'm a kitesurfer and I support my surffriends with winddata primary from the spot where I live.
Now we got access to another spot with internet so we are going to setup station number 2 here.
Now we wan't data from these 2 spots to show on the same page on our webpage.
Yes I realized that I had to have 2 different names on the file.
But how can I call up tags from these two files?
How, where can I call up "require once" string?
/Per
Re: 2 stations on same site
Posted: Fri 29 Jul 2011 11:43 am
by beteljuice
It's a little bit more awkward than that ....
cumuluswebtags.php is really just a list or variables which you then do your own thing with.
Changing the (duplicate) file name OR its location will make accessing the file easier BUT the variable names in each list are the same, so makes working with them on the same page difficult.
It would best to edit the second include file so the variable names were unique.
eg.
$time_2 =
$day_2 =
Now you can use each sites data without confusion
In a similar manner, if you are doing any math or comparrisons you would need to duplicate that bit of code with the _2 variables.
Re: 2 stations on same site
Posted: Fri 29 Jul 2011 1:49 pm
by Per69
Hej
Yes, of course, that make since.
But what about require once?
Can I have two rows in code that call up for example cumuluswebtags_1.php and cumuluswebtags.php?
Can require once be read twice?
/Per
Re: 2 stations on same site
Posted: Fri 29 Jul 2011 1:55 pm
by steve
require_once() is just a way of 'including' other PHP files (and making sure each file only gets included once); so it's quite possible to do
<?php
require_once("cumuluswebtags_1.php");
require_once("cumuluswebtags.php");
?>
for example.
Re: 2 stations on same site
Posted: Fri 29 Jul 2011 2:25 pm
by Per69
Hej
Thank you all for answering.
I think these answers makes it all.
I'll get right on to it.
/Per
Re: 2 stations on same site
Posted: Sat 30 Jul 2011 8:36 pm
by Per69
beteljuice wrote:It would best to edit the second include file so the variable names were unique.eg. $time_2 = $day_2 =
I'm a little confused...
In the cumuluswebtags.txt file I guess I should change like this?
$time = "<#time_2>"; // the current date and time (example format: 18:30 on 25 Dec 2009)
And i cumuluswebtags.php like this?
$time_2 = "22:26 on 30 juli 2011"; // the current date and time (example format: 18:30 on 25 Dec 2009)
/Per
Re: 2 stations on same site
Posted: Sat 30 Jul 2011 10:05 pm
by steve
Per69 wrote:In the cumuluswebtags.txt file I guess I should change like this?
$time = "<#time_2>"; // the current date and time (example format: 18:30 on 25 Dec 2009)
You need to change just the PHP variables (like $time), not the web tags (like <#time>); you can't invent web tags which don't exist; <#time_2> doesn't exist.
Re: 2 stations on same site
Posted: Sun 31 Jul 2011 12:36 am
by beteljuice
To clarify ...
cumuluswebtags.php is simply the Cumulus processed and uploaded (renamed) cumuluswebtags.txt
So on the second station PC the uploaded (rename) file should be eg. cumuluswebtags_2.php
ALL the ($) variable names in the second station cumuluswebtags.txt should be changed to eg.
$time_2 = "<#time>";
Then in your main php page ..
require_once("cumuluswebtags.php");
require_once("cumuluswebtags_2.php");
Re: 2 stations on same site
Posted: Sun 31 Jul 2011 9:29 am
by Per69
Thanks!
No I'm clarified
/Per