1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Create a stand alone page

Discussion in 'Templates, HTML, CSS, and Design Help' started by jason1971, Apr 10, 2014.

  1. jason1971 Customer

    Hi all,

    Just wondering how I go about creating a stand alone page on my website, as I want to add a Google map, and the standard pages you can add does not allow me to do this. I assume I need a php file and tpl file, but I am totally unsure how to lay it all out.

    Be grateful for any guidance (idiot proof instructions would be even better :D) ... Jason
  2. freeze2 Super Moderator

    Should be quite simple...just create a directory within your root install and then build an index.php page however you want it to look. So if you want to build a page called mywebsite.com/location, create a folder in your root install, name it location, upload an index.php file within that folder and away you go :)
  3. Mike-N-Tosh Owner

    Well Jason, I learned a long time ago that if you make something "idiot proof", they will just make better idiots! :p

    Seriously, I'm not quite sure that I understand what you mean by, "the standard pages you can add does not allow me to do this.". Is it because you need to add in javascript and/or an iframe?

    Here's one of the methods that I've used before and since I know that you have a handle on the smarty "if's", you should be able to do this.
    1. Create your new page in the administration even just keep it blank (note the URI field).
    2. Open the "content.tpl" template file in your template folder.
    3. Add this line of smarty code: {if $smarty.request.pg == URI} (Replace URI with the URI field content, like "google-map")
    4. add whatever you want after that for that page including a smarty include template from your template folder file like this: {include file="googlemap.tpl"}
    5. End the smarty if: {/if}
    Anything that is either in the "content.tpl" file or any other template file that you create can contain any valid javascript or html. I have used the above method with additional elseif statements too and loaded javascript for a page or all admin generated pages, image maps, rss feeds from other sites, etc..

    Hope that helps. Post a link to what you create later and show it off! :D
  4. jason1971 Customer

    Hi Mike,

    Thanks for all your help (as usual, and you Freeze).

    Can I just confirm the setup, I have the following in Content.tpl file.

    {*$Revision: 164 $*}
    <h1><font color="#4399FC">{$title}</font></h1>
    {if $smarty.request.pg == google-map}<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.co.uk/maps/myplaces?num=10&amp;ie=UTF8&amp;t=m&amp;z=6"></iframe><br /><small><a href="https://maps.google.co.uk/maps/myplaces?num=10&amp;ie=UTF8&amp;t=m&amp;z=6&amp;source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small> {/if}
    {$pPageContent}

    and then I place {include file="googlemap.tpl"} in the actual page ?, If so, I am getting the message "This content cannot be displayed in a frame"

    I guess as usual I have ball's up somewhere, see I cant even get "idiot Proof" right :D

    Jason
  5. Mike-N-Tosh Owner

    Jason,

    I don't think that you need to use both inline html code (in the content.tpl) AND a {include file=xxx}. Use one or the other unless that is your intention and if that is your intention did you actually create and save a template file in your template folder by that name? If your intention is to include the separate template file, then you place that code within the {if} statement in the content.tpl file.

    I tried it both ways and got no error, BUT I didn't see the map within the iframe. I think the code that you have for the iframe is probably wrong. Where did you get it? The iframe was blank in both cases.

    When I did followed the link, Google put up a message that said that the content isn't supported in the "New Google Maps", so we changed you to the "Old Google Maps" temporarily and the map did display.

    Just so you know, frameborder, scrolling, marginheight, marginwidth are all deprecated and not supported in html5. You would need to move those properties to css styles to be compliant in html5. (e.g. <iframe width="425" height="350" style="border:none;margin:0;overflow:hidden;">, or in a separate stylesheet).

    Bottom Line: The code that you posted for your content.tpl should and does work properly (no need for the extra template file include), but something is wrong with src in the iframe code (the iframe content is blank). Either it is wrong or Google isn't allowing that content to be shown externally within an iframe. It's not something that you are doing wrong!

    I suspect the code that you are using is old and you need to regenerate the code @ Google.
  6. jason1971 Customer

    Cheers Mike ! Thank you very much:)

Share This Page