Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

How To embed HTML page inside PHP without an IFRAME

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

Moderators: daj, TNETWeather

User avatar
K8POS
Posts: 93
Joined: Sat Jan 03, 2015 4:17 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 7
Location: Thumb of Michigan
Contact:

How To embed HTML page inside PHP without an IFRAME

Postby K8POS » Fri Dec 08, 2017 10:57 pm

My coding knowledge is poor at best.


I have an HTML page that I want to place inside of a PHP page.
Right now I am using the <IFRAME> to do it. While it works, Iframe does have some draw backs.
I have tried using the INCLUDE function but it would not work.

Here is the raw HTML I am trying to place: http://www.melvinweather.com/gaugetest.htm

Here you can see it running in the IFRAME: http://www.melvinweather.com/template/indexDesktop.php

Here is the PHP file I am trying to embed the HTM in.

Code: Select all

<?php

   #       Name
   #       Namespace:      nameSpace
   #      Meteotemplate Block
   
      
   // load theme
   $designTheme = json_decode(file_get_contents("../../css/theme.txt"),true);
   $theme = $designTheme['theme'];
   
   include("../../../config.php");
   include("../../../css/design.php");
   include("../../../scripts/functions.php");
   
   $languageRaw = file_get_contents($baseURL."lang/gb.php");
   $language['gb'] = json_decode($languageRaw,true);
   $languageRaw = file_get_contents($baseURL."lang/".$lang.".php");
   $language[$lang] = json_decode($languageRaw,true);
   
?>
   

   
   
   <!-- BLOCK CONTENT -->


 <iframe src="http://www.melvinweather.com/gaugetest.htm"
        width="100%" height="590" frameborder="0"
        </iframe>


Any suggestions?

Bob

User avatar
beteljuice
Posts: 2468
Joined: Tue Dec 09, 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

Re: How To embed HTML page inside PHP without an IFRAME

Postby beteljuice » Sat Dec 09, 2017 1:40 am

It is unclear from the above if some the includes are true php (require processing) or are simply stuff that should be pasted in a html environment.

The easiest way to use html is to simply give it a .php extension, put in your usual html headers etc. and use
<?php
....
?>

In the required locations ;)
Image
......................Imagine, what you will KNOW tomorrow !


Return to “Web site - General”

Who is online

Users browsing this forum: Steepleian and 2 guests