[fw-general] Re: Extend Zend\Form\Form to output a div or article instead of input type text

2012-10-13 Thread fwahlqvist
Thank you for getting back to me.

I am aware that I can edit the .phtml file, the reason i want to change the
type is because i would like to make the div an editable region with a
jquery script and then save with the form features



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Extend-Zend-Form-Form-to-output-a-div-or-article-instead-of-input-type-text-tp4657572p4657578.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




[fw-general] Name spacing controllers

2012-10-13 Thread Steve Rayner
Using ZF2 I need to namespace my controllers because i have the same
controller names in different modules (ie index controller). If i
don't name space them some get lost in merged config. So my
controllers are named as;

'controllers' => array(
'invokables' => array(
'Inventory/Index' => 'Inventory\Controller\IndexController',
'Inventory/Items' => 'Inventory\Controller\ItemsController',
'Inventory/Categories' => 'Inventory\Controller\CategoriesController',
'Inventory/Locations' => 'Inventory\Controller\LocationsController'
)
)

I would like my URLs to look like this;

http://mysite/inventory/items/edit/1

I don't want to create a seperate route for each controller, because
if i have 50 controllers i don't want to have 50 routes. That would be
crazy.
So i tried to set up a route like this;

'route' => '\inventory[\:controller[\:action][\:id]]',
'default' => array(
'controller' => 'Index',
'action' > 'Index'
)

However this doesn't work because it looks for a controller named
index. I need a way of adding a namespace.
I would have thought this is a fairly normal use case. Basically as per ZF1.

Having seperate routes for each controller is a major problem for me.
To give an example i have added just five controllers so far and i
already  have over 120 lines of config code. All of it is just
repeated blocks of code only the controller name is different. That's
madness there has to be a better way.

Is there any way of namespacing controllers and still have a
controller parameter in the url and retain clean urls?
I've been looking at the '__NAMESPACE__' array key. However it does
not seem to have any effect. I've looked through the framework code
and the only place i can find it is in
Zend\Mvc\ModuleRouteListener.php (Line 22). This is used in the
function onRoute(McvEvent e$). However placing echo and die statements
in this functions leads me to beieve it is never invoked. So I must be
on the wrong track.

Any advice appreciated.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




[fw-general] Re: Extend Zend\Form\Form to output a div or article instead of input type text

2012-10-13 Thread luk
fwahlqvist wrote
> Hi All,
> 
> I want to change the behaviour of Zend\Form\Form to change the output type
> to be a 
> 
>  or an article instead. I am currently using the album tutorial as a
> training ground and planing to have a look to use a editable region
> instead to save the data. 
> All help and guidence re welcome.

You don't need to change behaviour of the Form element. Just go to your view
for ie.view/album/album/edit.phtml and put your div tags anywhere you like.
You can render form elements separately and they don't have any html
containers markups.



-
Cheers,
--
Luke Mierzwa
--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Extend-Zend-Form-Form-to-output-a-div-or-article-instead-of-input-type-text-tp4657572p4657576.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




[fw-general] Re: Replace Album tutorial route with title instead of ID

2012-10-13 Thread luk
fwahlqvist wrote
> Hi All,
> 
> I am trying to update the ablum module tutorial to us "title" instead as
> id in the route, 
> I have updated the route in module.config.php to 
> "'route' => '/article[/:action][/:title]',"
> however I am unsure on how I should update the AlbumController editAction
> and the edit.phtml to use title instead of ID, do I also need to update
> the AlbumTable.php?
> 
> All guidance welcome
> 
> Thanks in advance

You would need to only change id parameter from id to title in all the
palces where it's being passed to fetch an Album.

Controller changes:
public function editAction()
{
$title = $this->params()->fromRoute('title', '');

if (!empty($title)) {
return $this->redirect()->toRoute('album',
array('action'=>'add'));
}

$album = $this->getAlbumTable()->getAlbum($title);

Model\AlbumTable changes:
Change all the "$id" references to $title

public function getAlbum($title)
{
$rowset = $this->select(array('title' => $title));
$row = $rowset->current();

if (!$row) {
throw new \Exception("Could not find row $title");
}

return $row;
}

public function saveAlbum(Album $album)
{
$data = array(
'artist' => $album->artist,
'title'  => $album->title,
);

$id = (int)$album->id;

if ($id == 0) {
$this->insert($data);
}
else {

if ($this->getAlbum($title)) {
$this->update($data, array('id' => $id));
}
else {
throw new \Exception('Form id does not exist');
}
}
}



-
Cheers,
--
Luke Mierzwa
--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Replace-Album-tutorial-route-with-title-instead-of-ID-tp4657571p4657575.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




[fw-general] Re: Setting global value

2012-10-13 Thread luk
Paladyn wrote
> I wonder what is best way to set global language value and automatically
> pass it to url (clicking to a flag redirects to same place where user is,
> but with different language)?

You can create a language code route param in your routes, then on flag put
a url something like http://mysite.com/de which then from dispatch event
will detect that language, set it and redirect back user where he was.



-
Cheers,
--
Luke Mierzwa
--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Setting-global-value-tp4657568p4657574.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com




[fw-general] Re: Running PHP classes in controller

2012-10-13 Thread Marco Pivetta
You are simply not using the correct namespace:

new \ZipArchive();

or

use ZipArchive; // at the top of your file, after namespace declaration

new Ziparchive();

Marco Pivetta

http://twitter.com/Ocramius

http://marco-pivetta.com



On 13 October 2012 13:44, Paladyn [via Zend Framework Community] <
ml-node+s634137n4657569...@n4.nabble.com> wrote:

> I`m trying to lunch PHP class "ZipArchive" in controller ($zip = new
> ZipArchive();) but I`m getting error: Fatal error: Class
> 'Files\Controller\ZipArchive' not found in.
>
> Should I load this class somehow before using in controller?
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://zend-framework-community.634137.n4.nabble.com/Running-PHP-classes-in-controller-tp4657569.html
>  To start a new topic under Zend Framework, email
> ml-node+s634137n634138...@n4.nabble.com
> To unsubscribe from Zend Framework Community, click 
> here
> .
> NAML
>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Running-PHP-classes-in-controller-tp4657569p4657570.html
Sent from the Zend Framework mailing list archive at Nabble.com.

[fw-general] Re: getParam() issue

2012-10-13 Thread debussy007
Indeed it was because of a custom route!!!
Thank you Thomas!



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/getParam-issue-tp4657562p4657567.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com