How to Create Web Stories with CodeIgniter
How to Create Web Stories with CodeIgniter
- Create a new CodeIgniter 3 project.
- Create a new folder called "webstories" in the "application" folder.
- Create a new file called "index.php" in the "webstories" folder.
- In the "index.php" file, add the following code:
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class WebStories extends CI_Controller
{
public function index()
{
$this->load->library('webstories');
$this->webstories->generate('my-story');
}
}
- In the
config.php
file, add the following code to themodules
array:
$config['modules']['webstories'] = [ 'path' => APPPATH . 'modules/webstories', ];
- Save the
config.php
file. - Run the following command in the command line to generate your web story:
php spark generate:webstory my-story
- Open the
my-story.webstory.json
file in a text editor. - Edit the
my-story.webstory.json
file to add your content. - Save the
my-story.webstory.json
file. - You can now view your web story by opening the
my-story.webstory.html
file in your web browser.
Here is an example of a my-story.webstory.json
file:
This code will create a web story with two slides. The first slide will have the title "Slide 1", the image "image1.jpg", and the content "This is the content of slide 1." The second slide will have the title "Slide 2", the image "image2.jpg", and the content "This is the content of slide 2."
Web story:
#webstories, #codeigniter,#seo, #storytelling, #visual storytelling, #amp,#mobile-friendly, #interactive