I am little bit confused on how routes work in codeiIgniter. I have set up this following route
$route['myfirstest'] = 'Blogs';
I then set up a php file called blogs.php under the application/controllers directory
When I run the following URL
/code_igniter/index.php/myfirstest/hello/hello
I get a 404 message
However when I run this following URL
/code_igniter/index.php/blogs/hello/hello
It works find
Can anyone please help me figure this out..Maybe I am not getting the whole route thing correctly..
I think this will work for you
$route['myfirstest'] = 'Blogs';
$route['myfirstest/(:any)'] = "Blogs/$1"
This will also work for you.But I don't think this is your real purpose.
$route['myfirstest/hello/hello'] = "Blogs/hello/hello";
If you want any value inside hello function you can write this way
$route['myfirstest/hello/(:any)'] = "Blogs/hello/$1";
Remember for 2nd and 3rd solution you also need to write
$route['myfirstest'] = 'Blogs';
Related
In codeigniter I am routing my url www.xxxxxx.com/jewels to www.xxxxxx.com/luxury-jewels by using the following code in routes.php,
$route['(.*)luxury-jewels'] = "jewels";
the above code working well for english language when i am my other language its adding new parameter "ru" in the URL For Example:
www.xxxxxx.com/ru/luxury-jewels when doing this i am getting 404 Page Not Found error.
I tried different routing combinations its not working.
Intend of using
$route['(.*)luxury-jewels'] = "jewels";
use
$route['(:any)/luxury-jewels'] = "jewels";
Tested and works for me.
You need to add another route for it.
e.g
$route['ru/luxury-jewels'] = "jewels";
or
for many languages
$route['(:any)/luxury-jewels'] = "jewels";
My copy code doesnt work for some reason. Tried several things.
this is the code that I am trying to use
$fb_foto_url = $userData['picture']['data']['url'];
$plaats = '/assets/images/profielfotos/fiel.jpg';
copy($fb_foto_url, $plaats);
The $userData['picture']['data']['url']is getting filled with this for example: https://lookaside.facebook.com/platform/profilepic/?asid=113831052838678&height=200&width=200&ext=1527931138&hash=AeSlklMNX6l4Uanh
I need that to get stored in on the server. But it isn't working for some reason. I am doing something wrong but can't figure out what.
If someone can help me with this code, would be nice.
Try this:
file_put_contents($plaats,file_get_contents($fb_foto_url));
PHPs copy function expects path's, not URL's.
A (server-) path is a directory name on the machine the PHP code is executed on.
An URL is a virtual name that may or may not point to such a physical path or is resolved dynamically.
Example:
The server path to a websites images might be /var/www/example.org/assets/images/, while the URL is http://example.org/assets/images/.
http://php.net/manual/en/function.copy.php
I want a piece of code on the index of my Code Igniter's script so I can change the identety or name of my controller from agent69 to agent007_and_supergirl,and also a way to beat any rule that pages might have against using underscore to separate words as an amendment.
In other words I want that all the calls that the processor of my server has inside my code igniter for agent69 be translated to calls to agent007_and_supergirl
Is just a change of identety for the controller without altering the main controler's functionality and without getting my hands dirty with coding.
If you want re route your default controller url, you have to edit routing configuration like this:
in application/config/route.php
$route['agent007_and_supergirl'] = 'agent69';
Now agent69 Controller will be accessible by http://youriste.com/agent69 and http://yoursite.com/agent007_and_supergirl as well
CodeIgniter URI Routing Guide
Working on config/routes.php yelded miserabe results on past,remember that is an identity matter
And I want all the calls of agent69 be sent to agent007_and_supergirl that is its new identity
What was successfull on the past about this mattar was controller and file cloning,it worked masterfully
but this only intercepted few server calls so for me to get all the server calls, I need to clone every
single fie on the script so I feel silly teling you again thats why I didnt want to get my hands dirty with code
because is plenty of code.
Well hope that you can help me master this code that goes on the index of my code igniter script--///The code cant appear here so its below in the comment to lighta thanks 4 readin
I came from Codeigniter. In CI I had this:
$route['([a-z]+)tab'] = "$1/tab";
When I go to index.php/sometab/ I'll get some/tab/ action executed. But it doesn't redirect, instead I just tell CI that when I type this address I want to use another address instead, though there is no redirect.
Basically I want to achieve next goal: when I go to /someTab/ I want to execute some#tab action.
I only found Redirect::to_action in laravel, but I dont want the URL to be changed. I tried something like:
Route::any('([a-z]+)tab', function($controllerName) {
return Redirect::to_action("{$controllerName}/tab"); // here I want to tell to use $controllerName#tab action
});
How can I get this?
http://laravel.com/api/class-Laravel.Routing.Controller.html
There are some interesting methods here to. Route::cal, Route::forward, Route::execute...
I've written the question in symfony forum, but got no result. Of course I know that people may be busy or unavailable so I can't have my answer right away. But I really needs this fast, so I posted here too. If this is not permitted somehow, please just close the question. Thanks.
Originally posted here:
http://forum.symfony-project.org/viewtopic.php?f=22&t=31537
Hi,
I have some question regarding using zend pagination in zend lucene. Checked the old forum, and found this: forum.symfony-project.org/viewtopic.php?f=21&t=27342&p=103440&hilit=zend+pagination&sid=1cdc305c262c6b3cf79fdeef25761f34#p103440
But I need some additional feature for that. I've tried the code in the post above, and it works. But how do we implement it in view?
Checking zend documentation, i create a view file in /web/view/scripts/pagination.php
with the code for the file found here:
framework.zend.com/manual/1.10/en/zend.paginator.usage.html
With some modification for $this->url() to become link_to()
Then, the code in action looks like this:
$pager = Zend_Paginator::factory($query->execute()->getData());
$pager->setItemCountPerPage(3);
$pager->setCurrentPageNumber($request->getParameter('page', 1));
$pager->setDefaultScrollingStyle('Sliding');
Zend_View_Helper_PaginationControl::setDefaultViewPartial('_pagination.php');
$this->pager = $pager;
And in view:
<?php echo $pager ?>
The problem is, of course, is this the right thing to do?
Then, how can I get the current URL and modify its parameter in view? For zend, as I understands it, it's something like $this->url(array('page', 5)). Anyway to get this done in symfony?
Thanks before.
I've also check SO and get this:
stackoverflow.com/questions/2002648/is-there-a-symfony-helper-for-getting-the-current-action-url-and-changing-one-or
But I can't access $sf_request in the pagination.php mentioned above. I think it's because the pagination.php access Zend's front controller. And the strangest thing is, I can acess the default helper like UrlHelper (tried url_for and link_to - it works).
Ps. Sorry for the links in bold - can't post more than 1 link now.
View scripts usually have a .phtml extension, not .php, that won't matter, but just so you know.
Try changing
$this->pager = $pager;
To
$this->view->pager = $pager;