Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter, CronJobs, and Automatic URL generation
#1

[eluser]gh0st[/eluser]
I'm going to be starting a project where, for example;

somesite.com/page/{somepagealias}/

The {somepagealias} is a reference to a "page" in the database.

The pages are automatically generated via a 3rd party CSV/XML document (still to be decided) and a cron will create a "page" with an "alias".

My question is, because these are "dynamic" pages.

1) How does Google know where they are? Do I need to be creating a Google Sitemap? I need to do this automatically every sunday. This is my biggest issue.

2) CronJobs - What filepath do I give cron? Do I give it the index.php file, or the controller?

3) How does CI handle 404 errors, and what is the best way to resolve them?

Many thanks
#2

[eluser]obiron2[/eluser]
you will find it easier if it is somesite.com/page/autogenerate/{somepagealias}

Becuase CI natively uses uri(1) as the controller, uri(2) as the function and uri(3) as a variable.

Your controller is then called Page
your function in Page is called autogenerate($this->url_helper->uri(3)) {}

and somepagealias is passed as the view

It seems a bit extreme to store the whole of the view page as a string in a database. If the page is static, then save it in a file and store the location of the file in the database. If it is dynamic then you will need more functionality and probably a model to prepare the data for the view.

Obiron
#3

[eluser]gh0st[/eluser]
Hey thanks for your prompt reply.

I appreicate your answer.
#4

[eluser]gh0st[/eluser]
What about cron jobs -- what do you run, the index file, or the controller?
#5

[eluser]cwt137[/eluser]
How about using wget or curl for the cron job: wget http://localhost/index.php/controller/method/params
#6

[eluser]gh0st[/eluser]
Ah! Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB