Yii links not working properly - yii

In my Yii application I defined rules in Yii's urlManager as follows:
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'izletiste/<grad:\.*?>/<naziv:.*?>/<id:d+>'=>'izletiste/show',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
Now, when I want to create a link, I use the following construction:
<?php echo CHtml::link(CHtml::encode($izletiste->nazivIzletista),array("izletiste/show","grad"=>"Paris","naziv"=>"Some text", "id"=>$id)); ?>
The url I get is the following:
http://mywebsite.com/izletiste/Paris/Some+text/21
But when I click on the link, I get the following error:
Error 404
The system is unable to find the requested action "Paris".
My question is why is that happening, why Yii doesn't recognize that izletiste/show action should be called instead izletiste/paris, and how to fix this?

Try tho change first rule like here:
'izletiste/<grad>/<naziv>/<id:\d+>'=>'izletiste/show'

Related

Controller Not Found on prestashop 1.6 Admin panel

I have the message "Controller Not Found" when i try to see an order on my Prestashop Back-office.
The strange thing is that i have this error only on one order, and the others work correctly.
Do you have any idea ?
I'm on Prestashop 1.6.
Thanks a lot!
Please check that file AdminOrdersController.php is there at the following path of your PrestaShop directory:
/controllers/admin
If there is a file there then you can also check the permission for that file, it might be a permission issue.
Try deleting any closing php tags. That fixed my issue.
Thanks. I'm having the same issue.. I put that code in a controller file. I found out the issue in case. The issue was that I love code highlighting and often put <?PHP at the top of the blade views and the Controller (logic .php file).
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class JoeSearchController extends Controller
{
public function delete($id)
{
DB::table('user')->where('userID', '=', $id)->delete();
return redirect('history deleted');
}
}

yii2 fileinput not working

I'm new in yii2.
On my project use kartik\file\Fileinput;
In local its good working and when upload to my host get this error:
in the first of my file this :
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\file\FileInput;
PHP Fatal Error – yii\base\ErrorException
Class 'kartik\file\FileInput' not found
1. in /home/user/domains/myhost.com/public_html/modules/admin/views/photos/_form.php
at line 27 18192021222324252627282930313233343536
echo $form->field($model, 'filename[]')->widget(FileInput::classname(), [...
Try this use kartik\widgets\FileInput; instead of use kartik\file\FileInput;

yiibooster sortable table rows are not working

I have problem with a Yiibooster sortable table rows. It is not working because of two errors.
The file "http://yii-cms.com/protected/extensions/bootstrap/assets/js/jquery.sortable.gridview.js" is not found by the system (404), although the rest of yiibooster files are working and I did installation according to the instructions.
The path to the "jquery.sortable.gridview.js" is generated by the system, I checked it and that file exists.
I installed Yiiboster by writing:
<?php
// main/config.php
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');
'preload'=>array('log', 'bootstrap'),
// autoloading model and component classes
'import'=>array(
'application.models.*',
'application.components.*',
'application.modules.admin.components',
'application.modules.admin.models.*',
'bootstrap.*',
),
// application components
'bootstrap' => array(
'class' => 'bootstrap.components.Bootstrap',
),
?>
The second error occurs in view file, near the 'afterSortableUpdate' property.
Uncaught TypeError: undefined is not a function
Please give me some advice. Thanks.
This looks like a bug of YiiBooster, try it with the newest version or you may report it here. Please mention your Yii version and YiiBooster version.
The assets need to be properly registered within Yii, so that they are cached in the assets folder. The protected folder is protected and requests to it are blocked.

Yii - How to yiic.php migrate up domain.com

In yiic.php I include config: domian.config and futher crate yii app with main.config in which i try to use variables such as $db_serv, $db_user and so on. But these variables are undefined, although domian.config contains all of these.
are you sure your domain.config is executed before you load main.config?
$config = dirname(__FILE__) . '/protected/config/main.php';
this line in index.php on a yii project only defined a path. It dosn't execute the config in a first time.
Hope this helps

Yii module actions url

I have in my main project views/layouts/main.php the following 'events' module actions
array('label'=>'Events', 'url'=>'#', 'visible'=>UserUtility::isUser(), 'items'=>array(
array('label'=>'Konzerte', 'items'=>array(
array('label'=>'Erstellen', 'url'=>array('events/booking/create')),
array('label'=>'Verwalten', 'url'=>array('events/booking/admin')),
)),
If I click on 'Erstellen' the module action works perfectly. If I click on Verwalten afterwards I get the error
Error 404 Unable to resolve the request "events/events/concert/admin".*
The controller action obviously adds another
events/
in front of it if I'm already on a page from my events module. How can I overcome this problem?
You can try to create this url with createAbsoluteUrl() or add slash before /events
array('label'=>'Verwalten', 'url'=>array('/events/booking/admin')),