zend Navigation not right work cause zend router - zend-framework

my url is http://mysite.com/index/bytype/id/5/name/ACTION
when using zend router it'll be rewrite to http://mysite.com/index/bytype/5.ACTION.html
i was config in file router.ini like this:
routes.bytype.type = "Zend_Controller_Router_Route_Regex"
routes.bytype.route = "bytype/(\d+).(.*).html"
routes.bytype.defaults.module = "default"
routes.bytype.defaults.controller = "index"
routes.bytype.defaults.action = "bytype"
routes.bytype.map.1 = "id"
routes.bytype.map.2 = "name"
routes.bytype.map.3 = "page"
routes.bytype.reverse = "bytype/%d.%s.html"
code above have issue when i click button next page , it not jump to next page, cause Parameter page/2 not avalable, zend router was rewrite my url become to http://mysite.com/index/bytype/5.ACTION.html again,
if not rewrite it maybe look like http://mysite.com/index/bytype/id/5/name/ACTION/page/2
so how can i including "page" parameter into url above with zend router.thanks for reading

Try Zend routing on your Bootstrap.php file as an alternative.
Here is a tutorial on how to do that:
http://www.codexperience.co.za/post/hiding-url-parameters-names-using-zend-routers

Related

RealURL with GET parameters

We have developed a typo3 plug in that searches for trucks. For SEO reasons, we are trying to use the realURL plug in to make the URLs friendlier to use.
On the front page we have several call to actions that link to the search page with certain search parameters. An example is bellow:
/search-results/?tx_fds_searchresults[type_name]=Trailer
This link works as expected. On the results page is a link to the listings page with more details. An example is bellow:
/listing/?tx_fds_listing[id]=119870
This link is not working. tx_fds_listing[id] is not being populated in the arguments passed to the plug in controller.
At first we thought it might be a config issue but again, it isn't present on other pages.
The ID is not a database object and may be a text string instead.
Edit:
I should add that it works fine with RealURL turned off.
We get the id as $id = $this->request->getArgument('id');
Edit 2:
Here is the error message from the logs.
[ALERT] request="28233e225150a" component="TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler": Oops, an error occurred! Code: 201512141630381db91bba - {"exception":"exception 'TYPO3\\CMS\\Extbase\\Mvc\\Exception\\NoSuchArgumentException' with message 'An argument \"id\" does not exist for this request.'
I also tried renaming the variable to name, but that didn't work either.
I have a solution that solves the root cause of the problem, if not the specific issue.
So I had to add additional mapping to the realurl_conf.php file. For example to get the listing id:
$config['domain.com']['postVarSets'][3]['stock'] = array(array('GETvar' => 'tx_fds_listing[id]'));
This makes the effective URL:
/listing/stock/119870
This was the intended usage for the plugin, so this is a good result. I also added configuration for ajax and pdfs. This required modification to the typoscript that was not obvious.
PDF TS:
pdf = PAGE
pdf {
typeNum = 300
10 = USER_INT
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
#vendorName = TYPO3
extensionName = Fds
pluginName = Listing
#controller = FDS
controller = Tx_Fds_Controller_FDSController
#action = listingPdf
switchableControllerActions.FDS.1 = listingPdf
}
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:application/pdf
xhtml_cleaning = 0
admPanel = 0
}
}
PDF RealURL Config:
$config['domain.com']['postVarSets'][3]['pdf'] = array('type' => 'single', 'keyValues' => array ('type' => 300));
PDF effective URL:
/listing/pdf/stock/119870

how to make routing URL for our wish in zendframework using routes.ini file?

I need to the routing URL like the following
http://www.website.com/module-name/controller-name/{article-name}/{article-id}
i tried using the routes.ini file but it's not working
routes.index-latest.route = "index/latest/$1/:id"
routes.index-latest.module = "index"
routes.index-latest.defaults.controller = "latest"
routes.index-latest.defaults.action = "index"
routes.index-latest.defaults.id = ""
can you anyone suggest me on the issues or please tell me any other way to achieve the URL like through bootstrap file.
i searched on the net but i am not getting the right solution.
i fixed myself like example #
routes.index-latest.route = "index/latest/:article_id"
routes.index-latest.defaults.module = "module-name"
routes.index-latest.defaults.controller = "controller-name"
routes.index-latest.defaults.action = "action-name"
routes.index-latest.defaults.article_id = ""
routes.index-latest.defaults.reqs.article_id = "\d+{1,}"
in routes.ini

Zend Implementing SEO friendly or vanity URLs with router

I have a simple e-commerce web application with product URL's like:
http://www.example.com/product/view/product_id/15
where "Product" is the controller and "view" is the action in the Product Controller
How do I change this URL to show up as:
http://www.example.com/product/view/product_name/iphone-4S-16-gb
where product_id "15" is the primary key in the product table and product_name has the value "iphone 4s 16 gb" without the hyphens
What is the simplest way for me to make this change.
Would really appreciate your help.
Thanks a lot.
resources.router.routes.view-article.type = "Zend_Controller_Router_Route_Regex"
resources.router.routes.view-article.route = "articles/(?!archive)([a-zA-Z\-]+)/(\d+)(?:/(.*))?"
resources.router.routes.view-article.reverse = "articles/%s/%d/%s"
resources.router.routes.view-article.defaults.module = "articles"
resources.router.routes.view-article.defaults.controller = "view"
resources.router.routes.view-article.defaults.action = "view-article"
resources.router.routes.view-article.map.1 = topicSlug
resources.router.routes.view-article.defaults.topicSlug = topicSlug
resources.router.routes.view-article.map.2 = id
resources.router.routes.view-article.defaults.id = 0
resources.router.routes.view-article.map.3 = articleSlug
resources.router.routes.view-article.defaults.articleSlug = articleSlug
links like http://example.com/articles/circus/616/4-marta-vse-za-ruletkami
http://example.com/products/category/product_id/product_name
EDIT 1
this is a setup for default router plugin. shown as articles from my blog module, but easily updates for shop.
parts - http://example.com/ is host :) articles/circus/ => module and controller mapeed.
resources.router.routes.view-article.map.1 = topicSlug is a category. for shop.
616/4-marta-vse-za-ruletkami ID and any slug. product description, for example, 'iphone-4S-16-gb
'
defaults are in config.
another example /{maps2module}/{maps2topicSlug}/{maps2id}/{maps2articleSlug}

Zend Framework Rerouting for Friendly SEO URL?

I don't even understand where to start using the documentation and it's instructions. A little dumbfounded.
I have the URL : http://www.site.com/test/view/?aid=155 right now.
I want it to show up as http://www.site.com/test/155 (Using controller "test" and action "view" with parameter aid as 155)
and for future learning experiences, how would I do http://www.site.com/madeupname/155
Where would I start? What file?
What do I put in it?
Please and thank you!!!!!
It's not that hard to do, especially if you use an .ini file for your routes.
Create a routes.ini file inside of your /site/application/configs folder.
For example :
[production]
routes.home.route = /home/
routes.home.defaults.controller = index
routes.home.defaults.action = index
routes.login.route = /login/:username/:password
routes.login.defaults.controller = index
routes.login.defaults.action = login
routes.login.defaults.username = username
routes.login.defaults.password = password
and then bootstrap it
(inside bootstrap.php, add this)
/*
* Initialize router rewriting via .ini file.
*/
protected function _initRewrite()
{
$router = Zend_Controller_Front::getInstance()->getRouter();
$router->addConfig(new Zend_Config_Ini(APPLICATION_PATH. "/configs/routes.ini",
'production'), 'routes');
}
You could then access the login page with www.site.com/login/yourname/yourpass
or get to the home page via www.site.com/home
http://www.devpatch.com/2010/02/load-routes-from-routes-ini-config-file-in-zend-application-bootstrap/
http://framework.zend.com/manual/en/zend.controller.router.html

Codeigniter: form_open gave invalid function URL

I used this function to start a form:
echo form_open('email/send');
and after viewing the source I found that form_open returned duplicated index.php :
<form action="http://localhost/ci/index.php/index.php/email/send"
Note:
I tried keeping only this line of code in the page, but still gave me the same result
Edit1:
Base url : $config['base_url'] = 'http://localhost/ci/index.php/';
What is your index_page configuration item set to? If your base_url and index_page configuration items both include "index.php" then I imagine form_open() would duplicate it.
Change your application/config/config.php to:
$config['base_url'] = 'http://localhost/ci/';
//...
$config['index_page'] = 'index.php';