Welcome Guest, Not a member yet? Register   Sign In
Help with managing pages
#1

[eluser]Animas[/eluser]
I am planning to use CI for one of my project. Below is my project description.

Site will have thousands of pages with this format: www.domain.com/title-of-page1.html , www.domain.com/title-of-page2.html etc.

I will need to add hundreds(mass) of contents/pages at the same time. Probably pages from .cvs file where only Title & Description will be saved for import. Or using phpMyAdmin. Meta Desc, Meta Keyword will be automatically generated from Title(simply metatags=title).

This is a sort of cms/blog where only admin will post.

So is there any available CI feature(core or module) to start this project? Your suggestion is appreciated.
#2

[eluser]adamp1[/eluser]
I don't think there is. I have to say I never found a page library or something out there. Its rather a specific thing your asking for.

Some applications out there have a page system, but not like you want. I have a feeling you will need to custom make it.

Wouldn't be too hard I should think. Its just a simple CRUD type of admin form + an extra place to upload a cvs file to do multiple page creations.

Then all you need is a simple page controller.
#3

[eluser]Animas[/eluser]
[quote author="adamp1" date="1207319531"]Its just a simple CRUD type of admin form + an extra place to upload a cvs file to do multiple page creations.

Then all you need is a simple page controller.[/quote]

Can you please provide me a little more info on these? I am beginner level coder in php and new user of CI.
#4

[eluser]adamp1[/eluser]
Sorry, basically as you say you want a website to offer the ability to have many pages.

So first of all you will need some kind of admin area. For simplicity I would go for something like FreakAuth.

Then you need to create a CRUD page. Basically this stands for Create Review Update Delete. So this page would allow you to view all current pages on the system and also create new ones, update current ones and delete ones you don't want. Creating a crud page is very simple.
- You have a html table which is populated with all the pages with links to edit/delete
- You have a form to enter all your page details e.g title desc etc
- You have some background logic which processes all the requests and updates the database

Now the other thing you wanted is to be able to add mass pages. For this as you said cvs is a good choice. So you would also need to provide another page where you could upload a cvs file (with a pre-set format you need to specify before hand). You would then need to create a php script to parse each line of this file and add the values to the database.

It should be a very hard application to create, the hardest part being the cvs file handling.

I don't know if I have helped the situation any more, but do post again if your stuck.
#5

[eluser]Animas[/eluser]
Thank you for the elaboration. For the csv part I think I can export sql and learn the format then import my data. I was wondering how to create an html page from my table which has 4 fields(title, metadesc, metakey, desc) and how to create a link to this page on the site's frontpage at the same time?
#6

[eluser]adamp1[/eluser]
To create the HTML page with a table with the data you want I would have a look at these resources:

- Controllers
- Database Queries
- Dynamic HTML table creation

For the link to this page from the front page I would make sure you understand how controllers work. Then look at the following pages:

- CodeIgniter URL's
- URI Helper

I could give you the code to do it all but then you wouldn't learn anything :roll:. As said have a read of those and they will tell you how pages are created on CodeIgniter, how to access those pages, also creating links between them. The other thing it will tell you is how to interact with your database and run queries returning data & also how to create an HTML table using the CodeIgniter class (this step isn't totally required but may make your job a little simpler).

Good Luck
#7

[eluser]Animas[/eluser]
[quote author="adamp1" date="1207332817"]
I could give you the code to do it all but then you wouldn't learn anything :roll:[/quote]
Lol. Thanks for the directions you gave. I will be reading those docs.
#8

[eluser]Animas[/eluser]
I have read those but can't say I understood everything. Here is my progress.

I created a pages.php file inside application/controllers folder. Then I put the following code inside pages.php
Code:
<?php
class Pages extends Controller
{
    function Pages()
    {
        parent::Controller();

        $this->load->scaffolding('pages');
        $this->load->database();
    }
    function index()
    {
        $query = $this->db->get('pages');
        
        echo "<strong>List of Pages</strong><br />";
        foreach ($query->result() as $row)
        {
            echo $row->title;
            echo "<br />";
        }
    }
}

?&gt;

My database has a table "pages" which has 3 fields (id, title, content).

When I go to http://localhost/codeigniter/index.php/pages I get expected output:
Code:
List of Pages
page title 1
page title 2
page title 3

Now several issues I can't solve.
1. I need to make page titles(page title 1 etc) as hyperlink(which is ez) and this hyperlink will open there respective content/detail pages. I can create a controller page. But how it will show only the clicked titles from pages.php?

2. I showed the page list output inside pages controller. But couldn't show it within pagesview.php inside application/views. How to achieve this?

3. Can't figure it out where and how to put pagination code inside pages.php.

Any help?
#9

[eluser]Johan André[/eluser]
dude, you really should check out the basics in the docs... all you asking for is there...
#10

[eluser]adamp1[/eluser]
1. I need to make page titles(page title 1 etc) as hyper link(which is ez) and this hyper link will open there respective content/detail pages. I can create a controller page. But how it will show only the clicked titles from pages.php?

Right as said all you want to know is in the Documentation, for the problem of only showing a page you want in your controller try reading Passing URI segments to your functions.

2. I showed the page list output inside pages controller. But couldn’t show it within pagesview.php inside application/views. How to achieve this?

Seems like to need to understand views better, try this page CodieIgniter Views

3. Can’t figure it out where and how to put pagination code inside pages.php.
It seems like your trying to run before you can walk. Try to get 1 and 2 sorted before this. But as said all the information you need is on this page, Pagination Class

Now as said, all this information is in the user guide. It is probably the easiest to understand guide I have ever used. Most of the questions and problems you have asked are answered in there.

I don't mind helping people who require help on complex matters but I think some more work needs to be put in from your side. So Please make sure you have read all the things I have said, all your answers are there.




Theme © iAndrew 2016 - Forum software by © MyBB