Blade Pack: Include Google Map or other iframe/html code

The place for all your own modifications, code, etc.

Blade Pack: Include Google Map or other iframe/html code

Postby markfoz » Tue Aug 11, 2009 11:49 pm

Ok my first attempt - this could be improved but offers basic iframe functionality by (a bit hackily) loading the data from another html file into the php page. The html file (map.html) contains just the generated custom code for the googlemap from the googlemaps site (the iframe code).

This was done from just the very bare basics of the razorcms plugin code and im sure it can be much much better but hopefully somebody will find a use. Just use this code as the blade php file and then create the required xml file also using the required details then activate the blade - easy as that. the code here forms the very bare basics of any in page blade.

Code: Select all
<?php
///////////////////////////////////////////////////////////
// morgan integrated systems limited - razorCMS          //
// Blade Pack                                            //
// Include Google Map in page content                                   //
// GPLv3                                                 //
// Version 1.0                                           //
// smiffy6969                                            //
// www.razorcms.co.uk                                    //
// www.mis-limited.com                                   //
// 06/2009                                               //
///////////////////////////////////////////////////////////

///////////////////////
// Socket Allocation //
///////////////////////

// Add Blades to Sockets $bladeList['blade'] = 'socket'; //
$bladeList['addButtongoogleMap'] = 'admin-add-page-function';
$bladeList['scanPagegoogleMap'] = 'scan-content-slug';

///////////////////////
//      Blades       //
///////////////////////

// blade - ouput function button and place function in page //
function addButtongoogleMap(&$extraInfo,&$content) {
    if($_SESSION['adminLogIn']) {
   
            if( isset( $_POST['google-map'] ) ) {
                $content = stripslashes($_POST['content']);
                $content.= "in-page-blade(google-map)";
            }
            $extraInfo.= '<input id="button" type="submit" value="Add Map" name="google-map">&nbsp;&#166;';
        }
    }
   

//Output the data in page area
function scanPagegoogleMap(&$slugOut) {
   
//Define the custom code in a variable   
   $map = file_get_contents('map.html');
   
//Replace the in page tag with this variable and return the output   
        $slugOut = str_replace('<p>in-page-blade(google-map)</p>', $map , $slugOut);
        $slugOut = str_replace('in-page-blade(google-map)', $map , $slugOut);
}

?>
markfoz
 
Posts: 113
Joined: Sun Aug 09, 2009 2:41 pm

Re: Blade Pack: Include Google Map or other iframe/html code

Postby smiffy6969 » Wed Aug 12, 2009 7:57 am

Again, looks like your writing this for v1.0 upwards, this is great but will need to be accompanied with a xml file for settings and be package correctly for installation in the backend.

If you add the xml file (look how the others are done), then you need to zip the two files, this will allow the installer to automatically install and manage the bladepack

Look at the responses to your other post, great work though, I have a lot of time for people that make an effort to at least try something new, so for that you get my full attention.

If you wish I will take your google code later on this evening, and I will tidy it a little and package it correctly, you can then see the additions and or changes made and use as a template.

There is a doc but this is out of date, it explains how to create bladepacks but needs updating as the new v1.0 and above core uses a different blade pack system which is more efficient.

thanks and good work

smiffy

p.s. moving this to the your mods section.
smiffy6969
 
Posts: 1640
Joined: Sat May 24, 2008 8:18 am
Location: Loughborough, UK

Re: Blade Pack: Include Google Map or other iframe/html code

Postby nichess » Mon Jun 06, 2011 5:57 pm

Hello I tried to include the Google Maps Blade Pack, but with no luck. See Attachement.

It installs fine, there is no error information, and also no map :-)

Best

Nicolas
You do not have the required permissions to view the files attached to this post.
nichess
 
Posts: 4
Joined: Sat Jun 04, 2011 10:38 am

Re: Blade Pack: Include Google Map or other iframe/html code

Postby Adminer » Mon Jun 06, 2011 9:27 pm

Hi!

Try to do that like is in my example of blade pack: viewtopic.php?f=9&t=994

As you can see - it's working here without errors: http://eliteria.pl/kontakt.htm

Important path: blade_packs/system_googlemap/mapa.html

and important file should be there with google map code: mapa.html


Code: Select all
///////////////////////
// Socket Allocation //
///////////////////////

// Add Blades to Sockets $bladeList['blade'] = 'socket'; //
$bladeList['addButtonGoogleMap'] = 'admin-add-page-function';
$bladeList['scanPageGoogleMap'] = 'scan-content-slug';

///////////////////////
//      Blades       //
///////////////////////

// blade - ouput function button and place function in page //
function addButtonGoogleMap(&$extraInfo,&$content) {
    if($_SESSION['adminLogIn']) {

            if( isset( $_POST['google-map'] ) ) {
                $content = stripslashes($_POST['content']);
                $content.= "in-page-blade(google-map)";
            }
            $extraInfo.= '<input id="button" type="submit" value="stamp GoogleMap" name="google-map">&nbsp;&#166;';
        }
    }


//Output the data in page area
function scanPageGoogleMap(&$slugOut) {

//Define the custom code in a variable
   $map = file_get_contents('blade_packs/system_googlemap/mapa.html');

//Replace the in page tag with this variable and return the output
        $slugOut = str_replace('<p>in-page-blade(google-map)</p>', $map , $slugOut);
        $slugOut = str_replace('in-page-blade(google-map)', $map , $slugOut);
}

?>


Regards
Adminer
 
Posts: 555
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland


Return to Your code

Who is online

Users browsing this forum: No registered users and 1 guest

cron