Page 2 of 2

Re: PHP

Posted: Sat 22 Aug 2015 11:47 am
by BCJKiwi
It seems you may need to make this change in the Cloudbase script discussed in this thread https://cumulus.hosiene.co.uk/viewtopic.p ... &start=120 See Steve's post of 22 Aug 2015, 22:44

Change this line in the script (around line 438);

Code: Select all

$data = explode(' ',$file[0]);
to

Code: Select all

$data = preg_split('/\s+/',$file[0]);
as your latitude will be less than 3 digits

Re: PHP

Posted: Fri 09 Oct 2015 10:01 am
by roxbux
Hello BCJKiwi . I really like the first site MX ( Saratoga ) . And ' possible to have a download link ? If it is possible also for all the others, at least to learn how to edit. thank you. Sorry for my English

Re: PHP

Posted: Sat 10 Oct 2015 1:52 am
by BCJKiwi
While I am happy to (and have) shared self-contained packages and some pages, am not prepared to face the significant support issues associated with a complete site.

If you want to have similar setup then start by downloading the Saratoga template set - there is a Cumulus version of it on the Saratoga Download site and a lot of information on how to get it all going. This is probably the best place to start http://saratoga-weather.org/wxtemplates/install.php
The gauges page is well covered on this Forum
After that there are the cloudbase and Davis Console scripts available from our website.
Have already posted the Trends (Graphs) page as well.

So you already have a lot to get you started.

Re: PHP

Posted: Mon 02 Nov 2015 5:07 pm
by michel7784
Hi everibody,

Id'like to thank Steeve for all these hours spended for all of us Single learning and advanced users.
I had a real pleasure to investigate and try to customize a few pages as your ModernMx site, but, fianlly, I must admit I'm quite unable to create some pages as these in php.
I'd really like to find someone giving a chance to lambda users to set up this version af dasdhboard, graphs and jauges on there website, quite as the noraml html pages given by Steeve.
I use Jacques Desroches's templates ( a little personnalized) for one of the stations, and I'd like to include the Cumulus interface pages in aother template I downloaded from Wim and his Leuven-Template.
Is there someone here to help me setting up these pages in php?

Thanks a lot

Michel

http://legheer.be/meteo
http://legheer.be/meteo3

Re: PHP

Posted: Mon 02 Nov 2015 7:13 pm
by nitrx
Do you have malware on the second link agggh :evil:

Re: PHP

Posted: Tue 03 Nov 2015 5:23 pm
by michel7784
Hi Ron,
did'nt find anything, never be mentioned as source of any problem.....
which kind of problem did you encounter ?

Michel

Re: PHP

Posted: Tue 03 Nov 2015 6:10 pm
by nitrx
Hmm strange on my pc nothing happens looks good but on my android tablet I was redirected to an advertisement, and could not reach your page.

Sorry for the 'false info'anyway strange that this happens.

Re: PHP

Posted: Tue 03 Nov 2015 6:58 pm
by michel7784
Don't matter Ron,

I tested on My wife's android tablet, it gave also an alert, but unable to find anything anoying at all....
Seems special and a little disturbing..

have a nice evening

Beste groetjes uit zuid belgiƫ

Re: PHP

Posted: Tue 03 Nov 2015 7:10 pm
by nitrx
Hi Michel well I hope your wife wasnt redirected to the same ad site as i was because i just tried it again and i landed on a pron site... If you know what i mean, on my pc i had a look at your source maybe the flash from yowindow is infected anyway you better can investigate your code.

Fijne avond

Re: PHP

Posted: Tue 03 Nov 2015 7:18 pm
by gluepack
Talking about php...

I had a piece of code inline that worked fine. I wanted to use it multiple times so put it in a function but it isn't returning anything.

What I don't understand is, in trying to debug it, as part of the function, there is a for loop and if I put an echo of the string that is being (appended to and) returned, they show and also an echo outside the for loop shows.
However, if I remove the echo from the for loop, the one outside it doesn't show...

for (....) {... echo $string; ...} echo $string; return $string;

shows all iterations plus final one

for (....) {...} echo $string; return $string;

doesn't show any. How is that possible? In neither case is the data returned.

Re: PHP

Posted: Tue 03 Nov 2015 9:30 pm
by gluepack
It is really confusing.
So, I have this chunk of text that I have modified to look like this.
...
...
<pre>
...
</pre>
...
...
<pre>
...
</pre>
...
...
<pre>
...
</pre>
....

The function in the above post gets everything between the <pre></pre> pair and massages it.
The calling code uses strpos to set up a substr to pass the data.
The function returns the massaged data and the code then preg_replaces the 1st occurrence of <pre> thru </pre> (i.e. including those tags) with it.
As I said in the previous post nothing was being returned when I was only testing for one occurrence. Now I see, having modified it to do the same thing three times (i.e. 1st time would remove 1st <pre></pre> pair so next one would be picked up, etc.), what is happening is 1st occurrence is being replaced with null, 2nd occurrence is being replaced with what should have been result of 1st and 3rd occurrence is being replaced with what should have been result of 2nd.
I just don't understand, how is that possible? The string is being generated correctly by the function, just not returned, however it is being returned on the next invocation. Arrgghhh!
i.e. I give it A, it works on it and it gives back nothing; I give it B, it works on it and it gives back massaged A; I give it C, it works on it and it gives back massaged B.

Re: PHP

Posted: Tue 03 Nov 2015 10:17 pm
by mcrossley
I think we'd have to see the code to comment.

Re: PHP

Posted: Wed 04 Nov 2015 1:40 am
by beteljuice
The most obvious things to look for as you have made it a function:

1/ Are you passing some 'input' to it ...
... or ...
2/ have you remembered to make some var 'global' ?

Re: PHP

Posted: Wed 04 Nov 2015 7:04 am
by gluepack
OK, this seems completely illogical to me but...

The pre's were to be replaced with a table (the returned string) in each case.
So, I took out virtually all the code from the function and assigned "aaaaaaaaaa" to the returning string and each pair of pre's were replaced correctly (i.e. with aaaaaaaaaa).
I was then going to work through the function adding a line at a time to see what sort of effect that would have so I then put my first line of code, which was exploding the input text, and my second line of code that established the returning variable with the <table> tag (and a caption).
Then, I thought "oops! I never add the </table> tag at the end before returning it." Sure enough, going back to the original code and doing $strtable .= '</table>'; prior to returning $strtable resolved it.

However, I can't believe that the lack of the </table> tag caused that effect. I can't prove (don't know how to) that nothing was being returned first time but, if that isn't the case, that means a table with no end tag will not be displayed until it hits a new <table> and yet anything in between behaves normally. Sorry for my ignorance but is that really the case? I'll have to try it some time.

Re: PHP

Posted: Tue 17 Nov 2015 9:33 pm
by philpugh
HTML 5 requires tags to be closed correctly - it's not entirely consistent yet :lol: but it will continue to get stricter I guess.

Also they are trying to discourage the use of the <table></table> entity to format layout preferring the 'new' layout tags to be used instead - along with appropriate CSS. The <table></table> entity should be used for tabulation of data only. It's difficult to make the change though!