There is nothing too much to say about this. This is a script for laravel developers that let the developer make functions as shortcode and use them in either controller of view. Static of database based dynamic codes can be developed inside the shortcode. There is no special coding skill you need. Just use normal laravel coding style according to the documentation and 2 sample shortcodes and you are ready to go.
In a single word- Easy to use and it is Master to make your project easy
- Copy App/Helpers/helpers.php to App/Helpers folder of your project.
- add the following line to “autoload” in composer.json file.
“files”: [“app/Helper/helpers.php”],
something like this:
“autoload”: {
“classmap”: [
“database”
],
“files”: [“app/Helper/helpers.php”],
“psr-4”: {
“App\”: “app/”,
},
}, - Run composer dump-autoload in your cmd terminal.
- If you already have that helpers.php file just copy the codes of App/Helpers/helpers.php to you helpers.php file.
- Copy Shortcode folder from App/Http/Controllers to your project App/Http/Controllers folder.
- SampleController.php has a sample shortcode system that you can check how to use.
- To make the shortcode work in view, use this function:
{!! generate_shortcode($content) !!} - Sample data is given in sample.blade.php in Resources/views folder.
- How to create a new shortcode:
- Shortcode without content (single ended shortcode)
$this->add_shortcode(‘sample1’, function($atts, $content = null){
extract($this->shortcode_atts(array(
‘name’ =>’world’
),
$atts));
return ‘Hello ’ . $name .’!’;
}); - Shortcode with content inside (double ended shortcode):
- $this->add_shortcode(‘sample2’, function($atts, $content = null){
extract($this->shortcode_atts(array(
‘col’ =>’col-md-12’
),
$atts));
return ‘ ’.$this->do_shortcode($content).’ ’;
}); - here sample1 and sample 2 are name of 2 shortcodes that will be used in content. properties like name in sample 1 and col in sample 2 are optinal but useful for customizations.
-
Where to create shortcodes:
App/Http/Controllers/Shortcode/Shortcodes.php
in this file all shortcodes will go under function __construct(){}
[eltd_button size=”huge-full-width” type=”outline” text=”Download & Demo Links” custom_class=”#” icon_pack=”font_awesome” fa_icon=”” link=”” target=”_blank” color=”” hover_color=”” background_color=”” hover_background_color=”” border_color=”” hover_border_color=”” font_size=”” font_weight=”” margin=””]
Demo = Laravel Shortcode for Developers
[eltd_button size=”huge” type=”” text=”Full Live Demo” custom_class=”” icon_pack=”font_awesome” fa_icon=”fa-laptop” link=”https://codecanyon.net/item/laravel-shortcode-for-developers/20364158″ target=”_blank” color=”” hover_color=”” background_color=”” hover_background_color=”” border_color=”” hover_border_color=”” font_size=”” font_weight=”” margin=””]
Kindly Note: We update new contents like WordPress Themes, Plugins, PHP Scripts everyday. But remember that you should never use this items in a commercial website. All the contents posted here for development & testing purpose only. We’re not responsible for any damage, use at your own RISK! We highly recommend to buy Laravel Shortcode for Developers from the The Developer ( code-men ) website. Thank you.
Download = Laravel Shortcode for Developers-[Updated].zip