TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,021
  • Total Topics: 21,332
  • Online today: 744
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 292
  • Total: 292

Articles, IFRAME, and themes

Started by johnwalkdaily, May 29, 2006, 01:58:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

johnwalkdaily

I'm using an <iframe> in an article to pull in an html page call maps.htm. Is there a way to inherit the theme/css? I have to explicitly call it out in the maps.htm page, but don't want to have to change the page manually if I switch themes or set it up for users to do so. I'm new to PHP, SMF, and TP.

article:
<IFRAME marginWidth=0 marginHeight=0 src="../content/maps.htm" frameBorder=0 width="100%" scrolling=no height=285>
This option will not work correctly. Unfortunately, your browser does not support Inline Frames
</IFRAME>


maps.htm:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Maps</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../Themes/tp_mercury11rc2/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="tborder">
  <table border="0" cellpadding="5" cellspacing="0" width="100%">
    <tr class="windowbg">
      <td valign="top"><span class="normaltext"><b>Parks/Trails</b>
        <ul>
          <li><a href="maps/hptrailmap.pdf" target="_blank">Howarth Park/Spring
              Lake</a> <em>(528 kb pdf)</em> </li>
          <li><a href="maps/ANNADELSP2.pdf" target="_blank">Annadel State Park </a> <em>(656
              kb pdf) </em><em>(brochure with map)</em></li>
          <li><a href="maps/wct2006.pdf" target="_blank">West County Trail, w/Joe
              Rodota Trail</a> <em>(1.82 mb pdf)</em></li>
        </ul>
        </span> </td>
      <td valign="top"><span class="normaltext"><b>Bicycle Plan Maps</b>
        <ul>
          <li><a href="maps/cycling/cloverdale.pdf" target="_blank">Cloverdale</a><em> (469
              kb pdf)</em> </li>
          <li><a href="maps/cycling/healdsburg.pdf" target="_blank">Healdsburg</a> <em>(466
              kb pdf) </em></li>
          <li><a href="maps/cycling/Petaluma.pdf" target="_blank">Petaluma</a><em> (808
              kb pdf) </em></li>
          <li><a href="maps/cycling/rp_cotati.pdf" target="_blank">Rohnert Park/Cotati</a><em> (714
              kb pdf)</em> </li>
          <li><a href="maps/cycling/santa_rosa.pdf" target="_blank">Santa Rosa</a><em> (1.60
              mb pdf)</em> </li>
          <li><a href="maps/cycling/sebastopol.pdf" target="_blank">Sebastopol</a><em> (353
              kb pdf)</em> </li>
          <li><a href="maps/cycling/sonoma.pdf" target="_blank">Sonoma</a> <em>(409
              kb pdf)</em> </li>
          <li><a href="maps/cycling/sonoma_county.pdf" target="_blank">Sonoma
              County</a> <em>(5.25 mb pdf) </em></li>
          <li><a href="maps/cycling/Windsor.pdf" target="_blank">Windsor</a> <em>(502
              kb pdf)</em> </li>
        </ul>
        </span> </td>
    </tr>
  </table>
</div>
</body>
</html>


Go to walkdaily.com and click on 'Maps' to see results.  While you're at it, let me know what you think of the site.

John
john@walkdaily.com


feline

first .. you must use php article and a php script to load in the iframe.

the php article:

global $settings;
echo '
<IFRAME marginWidth=0 marginHeight=0 src="../content/maps.php&th=' . $settings['theme_url']
. '" frameBorder=0 width="100%" scrolling=no height=285>
This option will not work correctly. Unfortunately, your browser does not support Inline Frames
</IFRAME>';


the maps.php:

$themeurl = '';
if (isset($_GET['th'])) $themeurl = $_GET['th'];

echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Maps</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="' . $themeurl .'/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="tborder">
  <table border="0" cellpadding="5" cellspacing="0" width="100%">
    <tr class="windowbg">
      <td valign="top"><span class="normaltext"><b>Parks/Trails</b>
        <ul>
          <li><a href="maps/hptrailmap.pdf" target="_blank">Howarth Park/Spring
              Lake</a> <em>(528 kb pdf)</em> </li>
          <li><a href="maps/ANNADELSP2.pdf" target="_blank">Annadel State Park </a> <em>(656
              kb pdf) </em><em>(brochure with map)</em></li>
          <li><a href="maps/wct2006.pdf" target="_blank">West County Trail, w/Joe
              Rodota Trail</a> <em>(1.82 mb pdf)</em></li>
        </ul>
        </span> </td>
      <td valign="top"><span class="normaltext"><b>Bicycle Plan Maps</b>
        <ul>
          <li><a href="maps/cycling/cloverdale.pdf" target="_blank">Cloverdale</a><em> (469
              kb pdf)</em> </li>
          <li><a href="maps/cycling/healdsburg.pdf" target="_blank">Healdsburg</a> <em>(466
              kb pdf) </em></li>
          <li><a href="maps/cycling/Petaluma.pdf" target="_blank">Petaluma</a><em> (808
              kb pdf) </em></li>
          <li><a href="maps/cycling/rp_cotati.pdf" target="_blank">Rohnert Park/Cotati</a><em> (714
              kb pdf)</em> </li>
          <li><a href="maps/cycling/santa_rosa.pdf" target="_blank">Santa Rosa</a><em> (1.60
              mb pdf)</em> </li>
          <li><a href="maps/cycling/sebastopol.pdf" target="_blank">Sebastopol</a><em> (353
              kb pdf)</em> </li>
          <li><a href="maps/cycling/sonoma.pdf" target="_blank">Sonoma</a> <em>(409
              kb pdf)</em> </li>
          <li><a href="maps/cycling/sonoma_county.pdf" target="_blank">Sonoma
              County</a> <em>(5.25 mb pdf) </em></li>
          <li><a href="maps/cycling/Windsor.pdf" target="_blank">Windsor</a> <em>(502
              kb pdf)</em> </li>
        </ul>
        </span> </td>
    </tr>
  </table>
</div>
</body>
</html>';


Thats all ...

Fel

johnwalkdaily

Thanks for the rapid response, feline! I'm having a few problems.

First, I'm getting a "The page cannot be found" in the frame.

Here's what I'm seeing in the forum error log:

admin   Today at 05:00:22 AM
71.131.15.4     bab1de2322adfdb65b81b415d542cdb7
http://walkdaily.com/index.php?action=tpadmin
8: Undefined index: tp_article_intro
File: /nfs/www/WWW_pages/smithers/walkdaily.com/Sources/TPortalAdmin.php
Line: 366


I did copy my maps.htm file, make the edits, and save it as maps.php in the same location.

G6Cad

The page can not be found usually turn up when the path to the page or the article is wrong

johnwalkdaily

I did try variations on the path:

../content/maps.php
/content/maps.php
content/maps.php
http://walkdaily.com/content/maps.php

None of them worked.

johnwalkdaily

Okay, I've figured out the rest.

First, I had to change the "&" to a "?" in the article code supplied by feline. Lucky guess on my part.

Second, I had to put in the <?php and ?> tags in the maps.php file.

Now everything is beautiful.

Thanks again for all the help :)

G6Cad

Strange, you shouldent have to put the php tags in the iframe if you have a php article for your iframe  ???

johnwalkdaily

The <?php ?> tags are in the maps.php file. Without the tags, the following code shows up at the top of the window above the html content:

$themeurl = '';
if (isset($_GET['th'])) $themeurl = $_GET['th'];


Once it put in the tags, the problem went away. I also tried other themes and things appear to be working flawlessly.

john

G6Cad

Ah, sorry, i thought you ment in the article  ::)

johnwalkdaily

Related concern:

If I select to use frame and title, I get about a 4 px dark gray space between the border of the article frame and the iframe.  If I just use the title, I get the same 4 px dark gray space between the title and the contents. See attached jpgs.

How can get rid of this so that it looks like a regular article?

Thanks,
john

This website is proudly hosted on Crocweb Cloud Website Hosting.