Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

html-php...

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
ivestfold
Posts: 31
Joined: Sat 28 Feb 2009 10:36 pm
Weather Station: WH1080
Operating System: Win7 Premium

html-php...

Post by ivestfold »

Hi guys.
Being really new (actually totally green!) to php, I have a couple of questions.
In the banner supplied by TNET (Cumulus PHP-GD Banner), I have to specify the directory for the fonts. I've made a font folder and uploaded it to my weather directory on the server containing the proper fonts, where the rest of my files are( banner.php and realtime.txt). How should I specify the path for the font directory in the script. By default it's ./. It obviously needs some editing, 'couse if I change usetff to yes, I get a lot of rubbish instead of the nice little banner.
Next question. How do I put the script into a .html page.? Could I just copy it inside the <body></body> tag, or do I need to take care of something else?

Newbie regards

Ingve
Image
User avatar
aadal
Posts: 168
Joined: Tue 04 Nov 2008 8:07 pm
Weather Station: WH 1080
Location: Skodje
Contact:

Re: html-php...

Post by aadal »

ivestfold wrote:Hi guys.
Being really new (actually totally green!) to php, I have a couple of questions.
In the banner supplied by TNET (Cumulus PHP-GD Banner), I have to specify the directory for the fonts. I've made a font folder and uploaded it to my weather directory on the server containing the proper fonts, where the rest of my files are( banner.php and realtime.txt). How should I specify the path for the font directory in the script. By default it's ./. It obviously needs some editing, 'couse if I change usetff to yes, I get a lot of rubbish instead of the nice little banner.
Next question. How do I put the script into a .html page.? Could I just copy it inside the <body></body> tag, or do I need to take care of something else?

Newbie regards

Ingve
Hi Ingve
Here is mine banner.php, may get an clue here.

Code: Select all

$SITE['version']        = "3.0";
$SITE['hloc']           = "./";
$SITE['datafile']       = "realtime.txt";
$SITE['image_width']    = 468;
$SITE['image_height']   = 60;
#---------------------------------------------------------------------------
$SITE['fontdir']        = "/usr/local/psa/home/vhosts/aadal.org/httpdocs/weather/jpgraph/fonts/";     # must contain ttf font files!
$SITE['usettf']         = "yes";        # Set to No to use default fonts
#---------------------------------------------------------------------------
$SITE['format']         = "png";        # Options: jpeg  gif  png 
$SITE['dateiso']        = "no";
$SITE['sitename']       = "Norway Skodje";
To find $SITE['fontdir'] use CheckServer.php
To put the script into a page the link to banner.php
Hope some help :D
And signature with link to your page like thise.

Code: Select all

[url=http://www.aadal.org/weather/][img]http://www.aadal.org/weather/banner.php[/img][/url]
  • Windows Vista
Image

Image
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: html-php...

Post by beteljuice »

Those are 'shortcuts', ie. relative to the location of the calling file.
/ = server (user) root directory
./ = current directory
../ = directory ABOVE current directory
../../ = TWO directories ABOVE current directory (NOT recommended - gets confusing !)
mydirectory/ = a directory called my 'mydirectory' below / within the current directory.

Confused - you will be :D
Last edited by beteljuice on Sun 15 Mar 2009 12:13 am, edited 2 times in total.
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
aadal
Posts: 168
Joined: Tue 04 Nov 2008 8:07 pm
Weather Station: WH 1080
Location: Skodje
Contact:

Re: html-php...

Post by aadal »

beteljuice wrote:Those are 'shortcuts', ie. relative to the location of the calling file.
/ = server (user) root directory
./ = current directory
../ = directory ABOVE current directory
mydirectory/ = a directory called my 'mydirectory' below / within the current directory.

Confused - you will be :D
Hmm thax for the information on that.
:D
  • Windows Vista
Image

Image
ivestfold
Posts: 31
Joined: Sat 28 Feb 2009 10:36 pm
Weather Station: WH1080
Operating System: Win7 Premium

Re: html-php...

Post by ivestfold »

Poor guys that replied to my request.. There's gonna be a lot more questions.. :oops:
So... my "fonts" folder which is located within the directory where I have my files should have the following path: fonts/
Right?
And Aadal, howhcome your script is a few centimeters long, while the downloaded one from TNET are 2 kilometers long?
And should'nt the script start with <?php and end with ?>. Or is that so elementary that you skipped it?

Thanks Aadal and Beteljuice :D

BR Ingve
Image
ivestfold
Posts: 31
Joined: Sat 28 Feb 2009 10:36 pm
Weather Station: WH1080
Operating System: Win7 Premium

Re: html-php...

Post by ivestfold »

okay, figured out the path to the fonts, thx to you guys(and checkserver)...
So, only the rest is left..
When the script is called from a html page via a url link, it opens in a new html page.
Should I paste the script into a html page to make the script appear there?

BR

Ingve
Image
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: html-php...

Post by beteljuice »

Aadal give you the clue in the second code box he posted !

It may be a php script, but it is creating an IMAGE, so ...
... within html treat it as an image ;)

Code: Select all

<image src = "http://mysite.com/weather/banner.php" width="468" height="60" border=0 />
But why would you put your own banner on your own weather site (Unless you are advertising it !)

So you would most likley want to add a (new page opening) link and a bit of 'mouse-over'.

Code: Select all

<a href="http://mysite.com/weather" target="_blank" alt="This is my great weather site" title="This is my great weather site"><image src = "http://mysite.com/weather/banner.php" width="468" height="60" border=0 /></a>
Image
......................Imagine, what you will KNOW tomorrow !
ivestfold
Posts: 31
Joined: Sat 28 Feb 2009 10:36 pm
Weather Station: WH1080
Operating System: Win7 Premium

Re: html-php...

Post by ivestfold »

Fantastic! Sorry for asking the spelling from A to Z, but the "image" said it all. And the idea to link it to my site is just for testing :) .Thanks for the help guys, now it works..
Image
User avatar
aadal
Posts: 168
Joined: Tue 04 Nov 2008 8:07 pm
Weather Station: WH 1080
Location: Skodje
Contact:

Re: html-php...

Post by aadal »

ivestfold wrote:Fantastic! Sorry for asking the spelling from A to Z, but the "image" said it all. And the idea to link it to my site is just for testing :) .Thanks for the help guys, now it works..
T. her eller der what?
Fortell videre.. ?
  • Windows Vista
Image

Image
ivestfold
Posts: 31
Joined: Sat 28 Feb 2009 10:36 pm
Weather Station: WH1080
Operating System: Win7 Premium

Re: html-php...

Post by ivestfold »

That one i didn't understand.. Could you (aadal) by the way tell me how you managed to get the date format in day-month-year?

BR Ingve
Image
TNETWeather

Re: html-php...

Post by TNETWeather »

ivestfold wrote:When the script is called from a html page via a url link, it opens in a new html page.
Should I paste the script into a html page to make the script appear there?

BR

Ingve
That would be an issue on that HTML page. There is nothing in the original script that would cause it to be displayed in a new page. Do you have a link to that page to show it?

Pasting the script itself into an HTML page would make it fail.
ivestfold wrote: Could you (aadal) by the way tell me how you managed to get the date format in day-month-year?
You can change the format of the date to whatever you want it to be in this section of code:

Code: Select all

if ( $SITE['dateiso'] == "yes" ) {
    // Fix date to use ISO formatted date
    $DATA[0] = "20" . substr($DATA[0],6,2) . '-' . substr($DATA[0],3,2) . '-' . 
        substr($DATA[0],0,2);
} else {
    // Fix date to use Month formatted date
    $DATA[0] = $months[intval(substr($DATA[0],3,2)) -1 ] . 
        " " . intval(substr($DATA[0],0,2)) . " " .
        "20" . substr($DATA[0],6,2);
}
Example:

Code: Select all

$DATA[0] = substr($DATA[0],0,2) . '-' . substr($DATA[0],3,2) . '-' . "20" . substr($DATA[0],6,2);
ivestfold
Posts: 31
Joined: Sat 28 Feb 2009 10:36 pm
Weather Station: WH1080
Operating System: Win7 Premium

Re: html-php...

Post by ivestfold »

Thanks for your help Kevin:-). I haven't quite understood what the changes in the script does, because I really don' understand what the different parameters are, but I copied in your example in my script, and now the date on the banner has the "correct" layout.
When it comes to that the script opened a new page I now understand. The fantastic thing about the script is that it's creating an image which I can link.. AS a matter of fact, when I wrote the first question here yesterday I was conpletely lost, but now, a couple of things are clearer already:-)
Thanks to the participating users:-)

BR Ingve
Image
Post Reply