These are chat archives for fansoro/fansoro

25th
Nov 2015
Sergey Romanenko
@Awilum
Nov 25 2015 05:11
@volter9 yes
@/all @volter9 Morfy has 30 plugins, Admin Panel and Several themes.
Sergey Romanenko
@Awilum
Nov 25 2015 05:18
@volter9 and we will create 20 plugins more until and of these year.
Sergey Romanenko
@Awilum
Nov 25 2015 15:06
@/all Page Inject plugin for Morfy! That allows you to inject the page into other pages. https://github.com/morfy-cms/morfy-plugin-page-inject
xxwebplus
@xxwebplus
Nov 25 2015 15:10
@Awilum :+1:
xxwebplus
@xxwebplus
Nov 25 2015 15:25

@/all I need help ! what am I doing wrong and I can not call code template;

maps.php

<?php

/**
 * Maps
 *
 * @package Morfy
 * @subpackage Plugins
 * @author xxwebplus http://xxwebplus.eu
 * @copyright 2015 xxwebplus http://xxwebplus.eu
 * @version 1.0.0
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

// Add css on head
Action::add('theme_header', function () {
  echo('<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>');
});

// Add javascript on footer
Action::add('theme_footer', function () {
  echo('<script rel="javascript">
        /*==========  Map  ==========*/
        var map;
        function initialize_map() {
            if ($("#map").length) {
              var myLatLng = new google.maps.LatLng(lat,lng);
              var mapOptions = {
                zoom: 6,
                center: myLatLng,
                scrollwheel: false,
                panControl: false,
                zoomControl: true,
                scaleControl: false,
                mapTypeControl: false,
                streetViewControl: false
              };
              map = new google.maps.Map(document.getElementById("map"), mapOptions);
              var marker = new google.maps.Marker({
                position: myLatLng,
                map: map,

              });
            } else {
              return false;
            }
        }
        google.maps.event.addDomListener(window, "load", initialize_map);
    </script>');
});

// Add template {maps(['lat'=>'37.984062' 'lng'=>'23.728113' 'height'=>'400px'])}
// Add Shortcode {maps lat="37.984062" lng="23.728113" height="400px"}
Shortcode::add('maps', function($attributes){
    // Extract
    extract($attributes);
    //  lat
    if (isset($lat))   $lat = $lat;  else  $lat = "";
    // lng
    if (isset($lng))  $lng = $lng; else  $lng = "";
    // Height
    if (isset($height)) $height = $height; else $height = "";
    $template = Template::factory(PLUGINS_PATH . '/maps/templates/');
    // Set template option: strip = true to prevent markdown LINES AUTO FORMATING
    $template->setOptions(["strip" => false]);
    return $template->fetch(
        'maps.tpl',[
            'lat'   => $lat,
            'lng'  => $lng,
            'height'  => $height
        ]
    );
});

plugins/maps/templates/maps.tpl

<style>#map { height: {$height};margin: 10px 0 10px 0; }
</style>
<script>var lat = '{$lat}',lng = '{$lng}';</script>
<div id="map"></div>

maps.yml

name: Maps
version: 1.0.0
description: "Maps"
author:
  name: xxwebplus
  email: xxwebplus@gmail.com
  url: http://www.xxwebplus.eu
license: MIT

# Plugin settings
enabled: true

Shortcode {maps lat="37.984062" lng="23.728113" height="400px"} page works
template {maps(['lat'=>'37.984062' 'lng'=>'23.728113' 'height'=>'400px'])} not works

Sergey Romanenko
@Awilum
Nov 25 2015 15:30
@xxwebplus okey, please post also a link, where it possible to download it
xxwebplus
@xxwebplus
Nov 25 2015 15:31
ok wait!
Sergey Romanenko
@Awilum
Nov 25 2015 15:55
@xxwebplus checking..
xxwebplus
@xxwebplus
Nov 25 2015 15:57
:)
Sergey Romanenko
@Awilum
Nov 25 2015 16:02
@xxwebplus check now
@xxwebplus works now
xxwebplus
@xxwebplus
Nov 25 2015 16:03
@Awilum tnx bro!
xxwebplus
@xxwebplus
Nov 25 2015 16:14
@Awilum call {maps(['lat'=>'37.984062' 'lng'=>'23.728113' 'height'=>'400px'])} not works
error: Function maps not found in index.tpl line 27, near '{maps(' <- there
Sergey Romanenko
@Awilum
Nov 25 2015 16:15
delete your plugin
xxwebplus
@xxwebplus
Nov 25 2015 16:15
yes
Sergey Romanenko
@Awilum
Nov 25 2015 16:15
and upload my insteead
did you install it ?
xxwebplus
@xxwebplus
Nov 25 2015 16:16
yes I know how to install :)
Sergey Romanenko
@Awilum
Nov 25 2015 16:16
and this shotrcode
its only for text
maybe you try to put it inside templates
thats why u see such error
xxwebplus
@xxwebplus
Nov 25 2015 16:17
template {maps(['lat'=>'37.984062' 'lng'=>'23.728113' 'height'=>'400px'])} not works
Shortcode {maps lat="37.984062" lng="23.728113" height="400px"} page works
Sergey Romanenko
@Awilum
Nov 25 2015 16:17
yes its wrong
2 min
xxwebplus
@xxwebplus
Nov 25 2015 16:18
jeje
no problem
Pavel Belousov
@pafnuty
Nov 25 2015 16:20
@xxwebplus
{
maps(['lat'=>'37.984062' 'lng'=>'23.728113' 'height'=>'400px'])
}
Sergey Romanenko
@Awilum
Nov 25 2015 16:20
{maps(['lat'=>'37.984062','lng'=>'23.728113','height'=>'400px'])}
must be
and wait, I will upload a new code
xxwebplus
@xxwebplus
Nov 25 2015 16:21
@pafnuty not worrk
Pavel Belousov
@pafnuty
Nov 25 2015 16:21
:(
Sergey Romanenko
@Awilum
Nov 25 2015 16:21
@xxwebplus check my code
xxwebplus
@xxwebplus
Nov 25 2015 16:21
@Awilum ok
Sergey Romanenko
@Awilum
Nov 25 2015 16:21
and you must use , in the templates
xxwebplus
@xxwebplus
Nov 25 2015 16:24
Pavel Belousov
@pafnuty
Nov 25 2015 16:25
надо ещё яндекс карты запилить
Sergey Romanenko
@Awilum
Nov 25 2015 16:25
:)
xxwebplus
@xxwebplus
Nov 25 2015 16:27

@Awilum I saw that was the problem!
Shortcode::add('maps', function ($attributes) bad
Shortcode::add('maps', 'maps');

function maps($attributes) good

Sergey Romanenko
@Awilum
Nov 25 2015 16:28
that is if you want to use it in both places
xxwebplus
@xxwebplus
Nov 25 2015 16:29
:+1:
I have a question still: I can have separate css and javascript file with the parameters;
Sergey Romanenko
@Awilum
Nov 25 2015 16:32
create a template or js file
and use it
xxwebplus
@xxwebplus
Nov 25 2015 16:35

example maps

ago

<?php

/**
 * Maps
 *
 * @package Morfy
 * @subpackage Plugins
 * @author xxwebplus http://xxwebplus.eu
 * @copyright 2015 xxwebplus http://xxwebplus.eu
 * @version 1.0.0
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

// Add css on head
Action::add('theme_header', function () {
    echo('<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>');
});

// Add javascript on footer
Action::add('theme_footer', function () {
    echo('<script rel="javascript">
        /*==========  Map  ==========*/
        var map;
        function initialize_map() {
            if ($("#map").length) {
              var myLatLng = new google.maps.LatLng(lat,lng);
              var mapOptions = {
                zoom: 6,
                center: myLatLng,
                scrollwheel: false,
                panControl: false,
                zoomControl: true,
                scaleControl: false,
                mapTypeControl: false,
                streetViewControl: false
              };
              map = new google.maps.Map(document.getElementById("map"), mapOptions);
              var marker = new google.maps.Marker({
                position: myLatLng,
                map: map,

              });
            } else {
              return false;
            }
        }
        google.maps.event.addDomListener(window, "load", initialize_map);
    </script>');
});

// Add template {maps(['lat'=>'37.984062','lng'=>'23.728113','height'=>'400px'])}
// Add Shortcode {maps lat="37.984062" lng="23.728113" height="400px"}
Shortcode::add('maps', 'maps');

function maps($attributes)
{

    // Extract
    extract($attributes);

    //  lat
    if (isset($lat)) {
        $lat = $lat;
    } else {
        $lat = "";
    }

    // lng
    if (isset($lng)) {
        $lng = $lng;
    } else {
        $lng = "";
    }

    // Height
    if (isset($height)) {
        $height = $height;
    } else {
        $height = "400";
    }

    $template = Template::factory(PLUGINS_PATH . '/maps/templates/');

    // Set template option: strip = true to prevent markdown LINES AUTO FORMATING
    $template->setOptions(["strip" => false]);

    return $template->fetch(
        'maps.tpl', [
            'lat'   => $lat,
            'lng'  => $lng,
            'height'  => $height
        ]
    );
}

after

<?php

/**
 * Maps
 *
 * @package Morfy
 * @subpackage Plugins
 * @author xxwebplus http://xxwebplus.eu
 * @copyright 2015 xxwebplus http://xxwebplus.eu
 * @version 1.0.0
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

// Add css on head
Action::add('theme_header', function () {
    echo('<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <link href="'.Url::getBase().'/plugins/maps/assets/maps.css" rel="stylesheet">');
});

// Add javascript on footer
Action::add('theme_footer', function () {
    echo('<script src="'.Url::getBase().'/plugins/maps/assets/maps.js"></script>');
});

// Add template {maps(['lat'=>'37.984062','lng'=>'23.728113','height'=>'400px'])}
// Add Shortcode {maps lat="37.984062" lng="23.728113" height="400px"}
Shortcode::add('maps', 'maps');

function maps($attributes)
{

    // Extract
    extract($attributes);

    //  lat
    if (isset($lat)) {
        $lat = $lat;
    } else {
        $lat = "";
    }

    // lng
    if (isset($lng)) {
        $lng = $lng;
    } else {
        $lng = "";
    }

    // Height
    if (isset($height)) {
        $height = $height;
    } else {
        $height = "400";
    }

    $template = Template::factory(PLUGINS_PATH . '/maps/templates/');

    // Set template option: strip = true to prevent markdown LINES AUTO FORMATING
    $template->setOptions(["strip" => false]);

    return $template->fetch(
        'maps.tpl', [
            'lat'   => $lat,
            'lng'  => $lng,
            'height'  => $height
        ]
    );
}
or github
Sergey Romanenko
@Awilum
Nov 25 2015 16:45
@pafnuty good point. :+1:
xxwebplus
@xxwebplus
Nov 25 2015 16:47
@pafnuty the same as I did above
Pavel Belousov
@pafnuty
Nov 25 2015 16:48
one link vs two long code :)
xxwebplus
@xxwebplus
Nov 25 2015 16:48
jeje
Now I will try to create a plugin with screenshot site
Sergey Romanenko
@Awilum
Nov 25 2015 17:05
@xxwebplus what this plugin will do ?
xxwebplus
@xxwebplus
Nov 25 2015 17:07
@Awilum feedback for idea, bugs, suggestions, and screenshot
Sergey Romanenko
@Awilum
Nov 25 2015 17:50
@/all :sparkles: Snow plugin to generate snowflake for Morfy :sparkles: :) https://github.com/morfy-cms/morfy-plugin-snow
Pavel Belousov
@pafnuty
Nov 25 2015 18:17
ох, скоро начнётся очередной приступ снега у заказчиков :)
Sergey Romanenko
@Awilum
Nov 25 2015 18:18
:)
Sergey Romanenko
@Awilum
Nov 25 2015 20:50
Сейчас сезон новогодних плагинов )