EllisLab Community Forums 1969-12-31T19:00:00Z Copyright (c) 2014 ExpressionEngine tag:ellislab.com,2014:04:17 Tutorial Foreach not working tag:ellislab.com,2013:forums/viewthread/.238750 2013-11-04T14:05:17Z 1969-12-31T19:00:00Z HarleyRowland I am trying to work through the CodeIgniter tutorial and my news pages won’t output data from the foreach loop. I get the following messages:

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: news

Filename: pages/index.php

Line Number: 1
and

A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: pages/index.php

Line Number: 1
This is my model class:

<?php
class News_model extends CI_Model {

public function __construct()
{
    $this
->load->database();
}


public function get_news($slug FALSE)
{
if ($slug === FALSE)
{
    $query 
$this->db->get('news');
    return 
$query->result_array();
}

$query 
$this->db->get_where('news', array('slug' => $slug));
return 
$query->row_array();
}


public function index()
{
$data[
'news'$this->news_model->get_news();
$data['title''News archive';

$this->load->view('templates/header'$data);
$this->load->view('news/index'$data);
$this->load->view('templates/footer');
}

And my controller:

class News extends CI_Controller {

public function __construct()
{
    parent
::__construct();
    
$this->load->model('news_model');
}

public function index()
{
    $data[
'news'$this->news_model->get_news();
}


public function view($slug)
{
    $data[
'news_item'$this->news_model->get_news($slug);

    if (empty(
$data['news_item']))
    
{
        show_404
();
    
}

    $data[
'title'$data['news_item']['title'];

    
$this->load->view('templates/header'$data);
    
$this->load->view('news/view'$data);
    
$this->load->view('templates/footer');
}

And the first view:

<h2><?php echo $news_item['title'] ?></h2>
    <
div id="main">
        
<?php echo $news_item['text'] ?>
    
</div>
    <
p><a href="news/<?php echo $news_item['slug'] ?>">View article</a></p>

<?php endforeach ?> 

and the second:

<?php
echo '<h2>'.$news_item['title'].'</h2>';
echo 
$news_item['text']

I hope it isn’t something too stupid!

Thanks.

]]>
Need help regarding disabling cache tag:ellislab.com,2013:forums/viewthread/.238591 2013-10-25T03:25:57Z 1969-12-31T19:00:00Z gunadeep Hi everyone, I need to know what can I do to disable caching in a web application developed using Java.
Actually, my problem is, when I click on the back button, my site shows data that is outdated.

]]>
chart graphique tag:ellislab.com,2014:forums/viewthread/.242813 2014-02-10T03:42:24Z 1969-12-31T19:00:00Z Manel Bonjour;
je veux réaliser du chart graphique sous codeigniter mais j’ai pas trouvé un tutoriel simple.
pouvez_vous m’aider??

]]>
raffraichissement du contenu tag:ellislab.com,2014:forums/viewthread/.244438 2014-03-19T12:26:06Z 1969-12-31T19:00:00Z mannila je veux faire un rafraîchissement automatique de ma page chaque 1000 ms par exemple ,
pouvez vous m’aider.
Merci d’avance

]]>
Comment ajouter des colonnes pour un table générer par la class table et qui contient l’exécution d’une requête select ? tag:ellislab.com,2014:forums/viewthread/.242812 2014-02-10T03:38:55Z 1969-12-31T19:00:00Z nahed voici mon code: je veux ajouter deux colonne pour la suppression et la modification des champs de table?

$this->load->library(‘table’);
$tmpl = array ( ‘table_open’  => ‘<table border=“1” cellpadding=“2” cellspacing=“1” class=“mytable”>’ );
$this->table->set_template($tmpl);
$query = $this->db->query(“SELECT * FROM client”);
echo $this->table->generate($query);

]]>
Will money donation save Codeigniter? tag:ellislab.com,2014:forums/viewthread/.244941 2014-04-14T23:50:43Z 2014-04-14T23:51:13Z behnampmdg3 Hi Ellislab!

2 years ago I ran into CI and I couldn’t believe how simple it was!

Great framework, great documentation and good support.

Of course there was room for improvements but like every other project that needs attention.

Anyway what I mean is that it was not too behind from a being a great framework.

Last year I heard you guys are giving up on it.

Why did you guys give up on CI but not on your other products? Why Express Engine and not CI?

You haven’t posted anything about CI for months.

Do you know how many people globally are using CI? A lot. A lot worth that I think is anything you MUST ASK FROM MEMBERS TO DONATE SOME MONEY TO GET CODEIGNITER BACK TO LIFE BECAUSE IT IS WORTH IT.

I HAPPILY DONATE NOTICEABLE AMOUNT TO KEEP CI AROUND.

I’m warning you, if you give up on CodeIgniter you will never get a threesome with 2 hot chicks.

Ben

]]>
csrf problem tag:ellislab.com,2013:forums/viewthread/.238737 2013-11-03T15:42:58Z 1969-12-31T19:00:00Z mamdouhweb Hi,
I’m really stock with csrf in IE and I had no where to go but here.
see this link for complete details.

stackoverflow question

main idea is that no matter what I do, CSRF won’t work in IE.

any help or suggestions?!

]]>
CodeIgniter Mail Configuration with localhost tag:ellislab.com,2014:forums/viewthread/.244796 2014-04-04T19:22:05Z 1969-12-31T19:00:00Z damilare_ogunnaike Hello,
I wrote a code fragment using codeigniter to send mails from localhost(Xampp specifically). It returns a success message but mail is not actually sent. I didn’t do any configuration in php.ini file.
Please I want to know if the mail will be sent when the site is hosted and also if I can get the configuration settings for CI_Mail and php.ini so the mail can be sent in localhost as well as online hosting.

]]>
appel d’un url de site pour être afficher dans un autre site tag:ellislab.com,2014:forums/viewthread/.244433 2014-03-19T08:44:41Z 1969-12-31T19:00:00Z mannila Bonjour,
j’arrive pas à appeler un url contenant un tableau pour être afficher dans un autre site .
Lorsque j’appelle cette url toute seul ça marche mais au moment où je veux l’inclure dans la page de nom site actuel rien ne s’affiche.
SVP aider moi smile

]]>
Moving Forward tag:ellislab.com,2014:forums/viewthread/.241138 2014-01-06T21:24:34Z 1969-12-31T19:00:00Z MallorcaMike OK, here’s something that’s going to get everyone all worked up.

For the past two years I have been building a framework on top of CI.  I love CI.  It actually made me take PHP seriously, coming from a Java and .Net background, so for the past two years I have been building my own framework with serious role based security, enhanced language support ( I live in Mallorca so ALL sites are multilingual ), modules based on HMVC which provide services like News Articles, Personnel Information, Contact Directory, very cool multiple photo Galleries with Crop, Resize, Rotate and front end site editing all based around Bootstrap.

I have based my business entirely around CI and my framework on top of that for two years.

Now, I’m finding limitations.  I’ve been looking towards Laravel and FuelPHP, but I just don’t “get it”  the language support etc just doesn’t seem flexible enough for me to hack in the way I have for CI, ie replacing files with DB and a really solid export/import for translation process.  The security model is nice as it’s easy to build a new “driver” etc, but I’m just not happy to say goodbye to CI for the general layout, much as I have been fighting with it for things like true modules etc.

I don’t want to give up on CI like a lot of people have.  It’s the one thing that has made PHP a viable language for me… sorry, but before I was really like…. PHP… yeah great… can we talk about a REAL language!

OK, so everyone is worried about the future, PHP 5.blah blah etc and OOP…. and yes I come from an OOP background, in fact I was recruited by Rational to become a trainer, but turned them down…. I know my OOP well enough and it’s not everything, but….

Something is missing here, and things are starting to slip a bit….

I want to use CI as the basis for a developers system that supports certain CMS things out of the box…. dynamic routing multilingual of course, but to start including templates, modules and real security out of the box.  True modules, with public attributes like css, images and upgrades/downgrades to dbs etc included like laravel, but keep it CI.

There are lots of things that I have either created or are on my to do list which is being done in a kind of get paid by client to improve model, which has worked for two years, but I would love some help with that I would like to do.  I think CI is the greatest framework yet, supporting php 4 and 5 at the same time and I don’t want to lose that, but there are somethings that I have to keep inventing that I would like NOT to…. although I can just go my own way, I would love to extend things as a group.  Mail me at mike dot as at mac dot com if you would like to join me.

( Please tell me this is OK within the licence currently )

]]>