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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,250
  • Total Topics: 21,354
  • Online today: 626
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online

Block or article, and what kind?

Started by winaje, March 26, 2007, 06:46:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

winaje

Hi, I want to create a place on my frontpage to add a google map.  I'm not sure if I should be using an article or a block.  In fact I am having trouble getting my head around the article/block idea generally...!

Anyway, the code I want to insert is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAATdfYaxjYNi8-EMhOLKjMKhQluY98pRUwTMgRhecRlZCZ1jw4XhSbHbwaQhpMt6Uy1ijzpJNWVC-9Gg"
      type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
      }
    }
    //]]>
    </script>
  </head>
  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: 500px; height: 300px"></div>
  </body>
</html>


Can someone please point me in the right direction?

Thanks

Lesmond

You can use either, front page or article, probably a front page block would be OK
I have redone your code, as you don't need most of it :) just place this in a script block, let us know how you get on  :)

    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAATdfYaxjYNi8-EMhOLKjMKhQluY98pRUwTMgRhecRlZCZ1jw4XhSbHbwaQhpMt6Uy1ijzpJNWVC-9Gg"
      type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
      }
    }
    //]]>
    </script>

  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: 500px; height: 300px"></div>
  </body>


I couldn't test it as I dont have the key set for my site :(

IchBin

Actually, if your page needs to include the head/body HTML tags I think you're better off including the article via php. But thats just my opinion.

winaje

Hi, thanks for the replies.  I have added the code by clicking "add php" in the aricle manager.  I get the following error:

Parse error: syntax error, unexpected '<' in /home/.tabakittyovenheater/winaje/d2au.com/Sources/Load.php(1736) : eval()'d code(209) : eval()'d code on line 1

I'm using Black14k-TP theme.

Thanks again

Porky

just put that code in a regular html article

winaje

Ok, (I think) I have pasted the code correctly.  I went to Article Manager/Add/clicked "source" to add the code/pasted it/clicked save.

I get the article shoing up, but there is nothing in it.  http://www.d2au.com/index.php?page=10

Thanks for the ongoing help.

Jpg

Quote from: winaje on March 27, 2007, 02:41:42 AM
Hi, thanks for the replies.  I have added the code by clicking "add php" in the aricle manager.  I get the following error:

Parse error: syntax error, unexpected '<' in /home/.tabakittyovenheater/winaje/d2au.com/Sources/Load.php(1736) : eval()'d code(209) : eval()'d code on line 1

I'm using Black14k-TP theme.

Thanks again

It's not gonna work because it doesn't have echo statements or enclosements.
Put it in a scriptbox.

IchBin

keep your page just the way you had it with all the html and stuff. In a php article you do not need the <?php or ?> tags. Put this in your article.

include('path/to/filename.html');

winaje

Thanks Ichbin.  I'm getting a bit confused with the multiple options here, so I think I will stick with your thread...

In the code that I posted right at the start of the thread, where should I put "include('path/to/filename.html');" and what would the path be?  Would it be the absolute path such as "/home/.tabakittyovenheater/winaje/d2au.com/......." etc, or would it be something else?

Thanks, and sorry for being a bit slow on the uptake with some of this stuff.

IchBin

Yes, too many people offering their input in this thread and not enough straight forwards answers. Sorry about that.
The include statement is the only thing that goes in your php article. Then the (absolute path) is what you put in between the quotes. This will call the file that you have the code in and automatically open it in your article.

This website is proudly hosted on Crocweb Cloud Website Hosting.