Welcome Guest, Not a member yet? Register   Sign In
Creating widgets containing links to pages
#1

I've made an open-source blogging application and I need some help with it. The application supports not only posts, but pages too.

also uploaded an instance of the application, with dummy content, on my server. Click on HERE to see it.

The concrete problem: in the footer of the site I display some pages (not posts). The way I display them is unsatisfactory for me, because it implicates hardcodeing:

   

Code:
<div class="col-sm-6 col-md-3">
      <h3>Legal</h3>
       <ul class="list-unstyled">
       <?php foreach ($pages as $page): ?>
        <li><a href="<?php echo base_url('pages/page/') . $page->id; ?>"><?php echo $page->title; ?></a></li>
       <?php endforeach; ?>
      </ul>
   </div>    


This allows me to display the pages in only one "box". Maybe I would find a solution that lacks... elegance (it would involve some if statements) to display two pages in each box


Perhaps widgets (like WordPress has) would be a good idea. Widgets in which I could drag-and-drop (links to) pages and other entities. I have not found any tutorials on making widgets in Codeigniter.

I don't now if CI has helpers or any other features to support widget creation. I am a beginner (intermediate at best) PHP developer so I don't know where to start creating this feature. Please help. Come with the best approaches.
Reply
#2

(This post was last modified: 12-07-2018, 09:36 AM by InsiteFX. Edit Reason: Add another link )

If you download and setup HMVC by Wiredesignz

Modular Extensions - HMVC

He had a Widgets class to work with it.

Widget Code is here

You might be able to re-write the Widget library and make it a stand alone one.

UPDATE:

Here is another one I just found.

CodeIgniter Widget (View Partial) Sample

Here is a newer one for CodeIgniter 3x.

CodeIgniter Widget
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB