Im trying to learn Laravel framework and having trouble with getURLList();
In the tutorial that im following it says.
class StudInsertController extends Controller
{
public function insert(){
$urlData = getURLList();
return view('stud_create');
}
But the getURLLIST(); comes back as
Call to undefined function App\Http\Controllers\getURLList()
And i dont find any information about that.
Is it because the tutorial is for older version of Laravel?
The link to the tutorial itself is here:
https://www.studentstutorial.com/laravel/insert-data-laravel
Can somebody point me in the right direction.
I would have written this as a comment, but I don't have enough reputation.
From what the tutorials says, there are just a few files that you need to touch which effectly means they are not adding a custom helper method.
After looking at the code, I don't see any use for the line of code getting the URLs. It would have been useful if you were to pass the data forward to your view.
So I would recommend you remove the line $urlData = getURLList();. It should work just fine. I don't know if the author left it there by error.
Related
I have read many entries and tried a lot (for example, viewhelpers), but unfortunately nothing works (which is definitely due to my little knowledge). We use the Zend Framework 2 internally with CdliTwoStageSignup (https://github.com/cdli/CdliTwoStageSignup). In this module i want to realize that you can only register if a specific date has not been exceeded. This is currently hardcoded, but should now work with a value from the sql database. This value is already used by other modules, but I do not get it in the module CdliTwoStageSignup. Otherwise, nothing is changed on the module. Unfortunately, I have little idea of php and Zend.
hardcoded looks like this: for submission_deadline a date is manually inserted at the moment
this is from module/CdliTwoStageSignup/view/email-verfication/form.phtml
<?php
if (time() < strtotime($this->submission_deadline)) {
print '<h2>Step 1: <small>Email Verification</small></h2>';
} else {
print '<h2>Step 1: <small>Email Verification (disabled)</small></h2>';
}
Because I have little idea of the framework, I searched in other modules and found that in a view/index.phtml:
<?php
//deadlines
if($this->activeSemester){
$submission_deadline = $this->activeSemester->getDtSubmissionDeadline();
}
Can I use that?
This is a public function in /otherModule/Entity/otherModule.php
public function getDtSubmissionDeadline() {
return $this->dtSubmissionDeadline;
}
So in conclusion is my question: How can I use the variable in this module, what is my problem? I have tried solutions from similar issues, but unfortunately nothing worked. If anything is missing, I'll be happy to complete it.
Thank you very much for your help!
This is my first project using both Codeigniter and Ion Auth and I've finished this tutorial: http://www.rappasoft.com/tutorials/view/5#.U1bJLeZdWpo
But now that I've reached the end, I have an error that is appearing when all of my code looks identical to the tutorial. The error is:
Message: Creating default object from empty value
Filename: core/MY_Controller.php
Line Number: 13
But the odd thing is that the code from the MY_Controller file is copied right from the tutorial. Here's the code I have:
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Controller extends CI_Controller {
public function __construct() {
parent::__construct();
if (!$this->ion_auth->is_admin()) {
redirect('auth/login');
} else {
//Store user in $data
$data->user_info = $this->ion_auth->user()->row();
//Load $the_user in all views
$this->load->vars($data);
}
}
}
?>
The correct view loads underneath the error but obviously I'd like to know what's wrong. Since this is my first turn time working with ion-auth and I'm relatively new to code igniter as well, I was wondering if anyone knew how to go about debugging an error like this. Teach a man to fish, feed him for a lifetime! I'd really appreciate not just solutions but methods so I can learn and do this on my own.
Are you working on PHP 5.4+ ?
In that case, you must declare $data before using it:
Change:
$data->user_info = $this->ion_auth->user()->row();
to
$data = new stdClass();
$data->user_info = $this->ion_auth->user()->row();
and try again. Hpe it helps!
I think I might have figured it out. I think the issue might be that the default login information (the ones provided by ion auth) do not have any additional information in the database. This means that when the $data variable goes to set the additional account information, it doesn't find anything. It's not a strong enough error to crash the page but it is warning me that there is no other account information available even though it is supposed to be looking for more info.
So how to fix this? Create a user for testing purposes with a full compliment of account information and see if that solves the problem. The only problem is that I don't know how to add new users using ion auth and my views aren't sophisticated enough yet to make that process easy.
I've looked at the create_user() method in the auth.php file but when you press submit after filling out the form, it kicks you back to the same page with all the info. I have a feeling an edit needs to be done here although I don't quite know what to change. I've been looking on the ion auth documentation but it seems a bit... sparse. I think I'm on the right track although I'd really like to hear if someone else has a better explanation or solution. As of now, I haven't actually fixed it yet. Just deduction.
Im totally new to cakephp and done some beginners tutorial and I see this line of code:
$this->User->find('all');
My question is this, where did 'User' come from since Ive never declared it on the program and I did not return an error but when I change the name of that, a bunch o errors happen.
Anyone pls help.
Go through the model documentation here http://book.cakephp.org/1.3/en/The-Manual/Developing-with-CakePHP/Models.html .
User is Model class in app/model folder.If you didnot created that ,cakephp will do it itself by default
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Call to a member function on a non-object
I'm doing this tutorial here:
http://tv.cakephp.org/video/webtechnick/2011/01/12/nick_baker_--_facebook_integration_with_cakephp
I baked a new project with cake bake facebook_app and set the configuration database file to the correct settings and the default cakePHP screen showed that tmp directory was writable, DB setup was good, etc.
I downloaded the CakePHP plugin by WebTechNick here: https://github.com/webtechnick/CakePHP-Facebook-Plugin, and filled out app information (app_secret, app_id, etc), adding it to facebook_app/config/facebook.php
Changed facebook_app/app_controller.php:
class AppController extends Controller {
var $name = 'Facebook';
var $helpers = array('Session', 'Facebook.Facebook');
}
Then just exactly as in the tutorial `facebook_app/views/pages/home.ctp':
<h1>Facebook_App</h1>
<?php $this->Facebook->share(); ?>
returning the error message:
Undefined property: View::$Facebook
I realize that means PHP didn't recognize Facebook as an object. But I installed the plugin!
Also, it seems not MVCish to have something like $this->Facebook->share(); in a view (home.ctp). However, this is exactly how WebTechNick does it in his tutorial (I followed it exactly 3x) and it does not work for me. I'm a complete noob at cakePHP (although I've read the entire documentation) and I'm just trying to learn and understand through examples.
:) To be fair, it's PHP - you didn't install anything. Or if you prefer, "install" != "invoke." PHP is really amazingly easy to debug. I mean, it tells you exactly what's wrong:
Like turning to a channel that's not on the air, the error your getting means that the object you're calling doesn't actually exist, at least not in the scope you're trying to invoke it.
Is that your IDE? Is it set up for your Cake app? Are you sure the instructions were to set your AppController's $name to 'Facebook' instead of $name = Facebook_App in your AppController? It looks like you either replaced your actual app's AppController with the plugin files instead of putting them in the proper directory, or the plugin is not deferring / calling / extending / returning to the application the way it's supposed to. Knee jerk -> typo, naming conflict, path problem, permissions.
Cake's not even rendering. I can tell because your screenshot would show that error with the styled Cake errors. That tells you it's erroring before AppController class makes it to View class.
Create an instance of the Facebook object statically in the view and see what happens. Then, what does
function beforeFilter() {
parent::__construct() ?
}
get you? Anything? What about debug(), var_dump, the object functions will also shed light on what's happening. So will your logfiles.
Btw, if you don't use them already: Firefox + FirePHP + Xdebug = made of win.
I was having this problem and I found that the plugin I was using was for CakePHP 1.3 and I was using Cake 2.0. I found the BETA branch for the upgraded Cake 2.0 and it worked perfect.
Here is the Cake 2.0 BETA Branch
I am seeking to learn how to implement a grid in an application I am working on and I figured I will use zfdatagrid as it seems to take care of some of the features I need. However there is not much by way of tutorial on the net. Probably because its easy to figure out, but thing is I need help to understand how use it. I will appreaciate any link that can help or if one will be kind to give me some pointers here.
Thanks.
I now get the following error:
Fatal error: Class 'Bvb_Grid' not
found in
D:\www\lab\zfdatagrid\application\controllers\IndexController.php
and below is my indexAction
public function indexAction()
{
//Zend_Config
$config = new Zend_Config_Ini(getcwd().'\..\application\grids\grid.ini', 'production');
var_dump($config);
//Grid Initialization
$grid = Bvb_Grid::factory('Bvb_Grid_Deploy_Table', $config, 'id');
//Setting grid source
$grid->setSource(new Bvb_Grid_Source_Zend_Table(new Bugs()));
//CRUD Configuration
$form = new Bvb_Grid_Form();
$form->setAdd(true)->setEdit(true)->setDelete(true);
$grid->setForm($form);
//Pass it to the view
$this->view->pages = $grid;
$this->render('index');
}
The Bvb library is located in the Library folder.
Well silly me I found the solution to the problem in another Stack Overflow thread Zend Framework 1.10 custom Class inside library folder not found
I thought of deleting the question then I thought this may save someone following this thread a google.