2017 © Pedro Peláez
 

library transports

Live CMS Transports

image

livecms/transports

Live CMS Transports

  • Wednesday, July 18, 2018
  • by mrofi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Welcome to Transport

The idea is how to transport your code (HTML and Javascript) from your business logic (Model - Controller) into View., (*1)

Like a global variable, when can set and access it from anywhere in our code., (*2)

Currently we provide HTMLTransport and JavascriptTransport. For HTML Transport, you can give it the name each time you set (inserting) the code into it, just like a variable. For Javascript, you can not insert identical script, just to make sure you don't duplicate your javascript code., (*3)

How to use

Install via composer :, (*4)

``` shell composer require livecms/transports, (*5)


HTML : ``` php require vendor/autoload.php; $htmlTransport = new LiveCMS\Transport\HtmlTransport; // Set new transport with name 'form' $html = '
'; $htmlTransport->set($html, 'form'); // Set new transport with name 'message' $html = '
Hello, Admin
'; $htmlTransport->set($html, 'message'); // Append code to 'form' $html = '
'; $htmlTransport->append($html, 'form'); // Show content of 'form' echo $htmlTransport->get('form'); /** Result :
*/ // Delete content of 'form' $htmlTransport->flush('form'); echo $htmlTransport->get('form'); /** Result : */ // Use method pull() to get content and delete it. echo $htmlTransport->pull('form'); // Delete all content $htmlTransport->flushAll(); echo $htmlTransport->get('message'); /** Result : */

Javascript :, (*6)

``` php, (*7)

require vendor/autoload.php;, (*8)

$jsTransport = new LiveCMS\Transport\JavascriptTransport;, (*9)

// Set new javascript code $js = <<set($js);, (*10)

// Adding another javascript code $js = <<append($js);, (*11)

// Adding another javascript code that same with previous, the code will not be saved. $js = <<append($js);, (*12)

// Show content echo $jsTransport->get();, (*13)

/** Result : $(':input').first().addClass('focus'); $('.message').text('Hi, bro. Whats up?'); */, (*14)

// Delete content $jsTransport->flush(); echo $jsTransport->get();, (*15)

/** Result : */ ```, (*16)

LICENSE

MIT, (*17)

CONTRIBUTING

Fork this repo and make a pull request, (*18)

ISSUE AND DISCUSSION

Please create new issue or see the closed issues too., (*19)

The Versions

18/07 2018

dev-master

9999999-dev https://github.com/livecms/transports

Live CMS Transports

  Sources   Download

MIT

by Mokhamad Rofiudin

18/07 2018

v0.0.1

0.0.1.0 https://github.com/livecms/transports

Live CMS Transports

  Sources   Download

MIT

by Mokhamad Rofiudin

18/07 2018

v0.01

0.01.0.0 https://github.com/livecms/transports

Live CMS Transports

  Sources   Download

MIT

by Mokhamad Rofiudin