strange problem with cakephp - php

I downloaded the latest version of cakephp. I use cake command line tool for creating a sample project. However, I edited the view file with corresponding controller file but the edited content does not appear. I try a test by rename the view folder of application but the view displayed normally. I think that the view I edited is not the true view cakephp use for rendering.
P/S: the view folder is under the application folder.
-- Edited
The file I edited is: C:\Program Files\xampp\htdocs\cakephp\myapp\views\posts\index.ctp
And the link I was trying to view is http://localhost/cakephp/myapp/posts/index . The edited content does not appear. I also tried an absurd test by deleting the view folder but the webpage display normally. I really don't understand what happened.

You do not need to construct the view again when you delete the var scaffold.
Make a index action (method) in the post controller and then your app get your index view.
Please read the cakephp docs for further information.

Related

The requested page does not exist.(Not getting satisfyng answer)

I am creating content management system for my project. I have created models and controllers in protected folder for admin-panel. It is working fine in admin panel but for accessing same controllers and models only changing the view for user-panel but I got the error of page not exist. I search that question here but i am satisfied with answer my issue remains the same. Thanks in advance.
double check your route file and see if the link or the page that is missing is added to your route file,
,
your route file depends on what mvc framework you are using,
Use aliases to achieve this, i suppose both the folders are independent applications.
http://www.yiiframework.com/doc-2.0/guide-concept-aliases.html
Create the alias for "admin-panel" in common/config/aliases.php
Yii::setAlias('admin-panel', dirname(dirname(__DIR__)) . '/admin-panel');
and while rendering the page in user-panel give the view path using alias
return $this->render("#admin-panel/views/controllername/file");**
**or whatever your folder structure is

Using PHP in Joomla Template

I'm developing a site using joomla template. I want to create a registration form & I design it with html in a Joomla Article. For data passing to db I have created a PHP file. But I have a problem in submitting data. I gave form action="php file name" & I save the PHP file in index path. But system is not working. Please tell me where I need to save that PHP file & how to link my joomla article & PHP file ???
Create a custom file upload component and upload your php files. Create a menu item for your component and assign a PHP file to menu you want to show your registration form on and finally at front-end include PHP file in your view.
Create a folder inside plugins in main directory.
Name it whatever you like, lets say, "customplugin". Put your form handling file in that.
Give the absolute path of this file in the form action URL.
This should work. Also, kindly check if the form tags are coming correctly in the article.
As others are saying, you are actually not using the Joomla CMS properly, but anything and everything is possible...
Mistakes are always forgivable, if one has the courage to admit them.
-- Bruce Lee

Yii2 Page not found when calling country/index

I was practicing to work with Yii2 based on the tutorial in this link : http://www.yiiframework.com/doc-2.0/guide-start-databases.html
I am using Advanced Application
These are the files that i have created:
frontend/models/Country.php
frontend/controllers/CountryController.php
frontend/views/country/index.php
now when i try to access it using index.php?r=country/index i get 404 not found error.
But if i move the actionIndex of CountryController to SiteCountroller and rename it to actionCountry and also move my view file inside site folder (and of course change the name of index.php to country.php) then i can successfully see the list of countries using the address index.php?r=site/country
Any ideas about the 404 not found error?
Examples in tutorial are for basic application and contains app\ in namespaces declaration. And you are using advanced application so for frontend it should begin with frontend\ (see for example SiteController in advanced application).
I think this is the reason since you said that file content is exactly the same, you didn't change default configuration and checked folders, files and classes for correct names.

Where to include js files ,in actions(controller) or view (zf2)?

Hi all im working on zf2, I was allways including js files from the view pages. But i can include it in the controller also using appendscript(). Which is the best method according to mvc ?
Javascript works with view output - the view knows, what javascript is needed to make everything work. And the view might not be directed to the browser, other view media might be used. For this reason, I prefere adding javascript from inside view.

Codeigniter Website is not responding

I am using the codeigniter framework for my website.
Previously my website was working fine. But a few days ago I made some changes in code (I add some files for cron job).
When I made these changes my website is not responding it is continuously connecting to the server.
I am using the stencil with the codeigniter.
When I use the ordinary codeigniter view function:
$this->load->view('view_name');
It was working but as I am using stencil paint:
$this->stencil->paint('view_name'); // its not working.
Website URL: http://blogsetu.com/
I would recommend you to read the documentation again there is something you might have missed we can't say any thing without viewing the full source code
However I think you missed to set a layout
from http://scotch.io/docs/stencil
Bare Minimum to Get Started Set a Layout in your Controller
You always will need to set a layout. This is required for Stencil.
Layouts are located in "/views/layouts/". To learn more, visit the
docs about layouts.
$this->stencil->layout('default_layout'); Set and Load a View with
the "paint()" function
To set and load a view you will initiate the "paint()" function. This
function is the equivalent to "$this->load->view($view)" in
Codeigniter.
To learn how to bind data to the view, please click here.
These are located in the "Pages" folder inside of the views folder.
The HTML from these pages are made available in the layout as the
$content variable.
$this->stencil->paint('example_view');

Categories