Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View in subfolder #845

Closed
raqulka opened this issue Feb 1, 2017 · 5 comments
Closed

View in subfolder #845

raqulka opened this issue Feb 1, 2017 · 5 comments

Comments

@raqulka
Copy link

raqulka commented Feb 1, 2017

I really like this starting template but would like to extend it a little or ask for guidance.

I would like to have a view in subfolder so the structure would look like this:
views
--medicines

----medicine1
----info.php
------forms
--------male.php
--------female.php

----medicine2
----info.php
------forms
--------male.php
--------female.php

----medicine3
----info.php
------forms
--------male.php
--------female.php

Is this something easy to implement or would it require a lot of work?

@elbenjaz
Copy link

elbenjaz commented Feb 1, 2017

You can do it like this:

$this->View->render('medicines/medicine1/info')
$this->View->render('medicines/medicine2/forms/male')

Take a look at /application/core/View.php ::render() to see how it works.

@raqulka
Copy link
Author

raqulka commented Feb 2, 2017

Yeah. that part is done and works fine. But how can I get the url to be for example URL/medicines/medicine1/forms/male ? Whereas medicines are controller and medicine one is an action but I would need to have 2 actions then? Because if I render the view like you said, I dont get any errors, but the page will still be URL/medicines/medicine1.

Any help appreciated!

@raqulka
Copy link
Author

raqulka commented Feb 6, 2017

BUMP!

@sr-verde
Copy link
Contributor

sr-verde commented Feb 9, 2017

I'm not sure if I get your problem: You control the URL with the name and the given variables in the controller. So you can have a function like

public function medicines($one, $two, $three)

If $three is optional, you can do it like that:

public function medicines($one, $two, $three = '')

I'm not sure if that is very pretty, but should work.

@sr-verde
Copy link
Contributor

sr-verde commented Mar 1, 2017

@raqulka Does that solve your problem?

@panique panique closed this as completed Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants