Welcome Guest, Not a member yet? Register   Sign In
Another simple one...
#1

[eluser]mdcode[/eluser]
Again, I appear to be going round in circles... I have a "projects" page, with a controller, model, and view. The index() of the projects controller points to "projects_main" in the folder views/default/pages -- this works...

What I am stuck on is this: On this page there is a list of links that point to other pages (add a project, edit a project etc.), but I just cannot seem to format the href link successfully (the page that should be loaded is in views/default/admin) so that the project_add view is shown, using the add() function in the controller, so the form can add the project (once filled out) using the query stated in the project_add() function in the model.

I hope that's explained clearly enough.
#2

[eluser]bretticus[/eluser]
I just load the url helper and use the anchor() function. Doesn't matter where your views and models are. The URL will always point to your controller first. if you controller is admin, then just build your link with achor('admin/add') etc.
#3

[eluser]Unknown[/eluser]
noob question..

What is the difference between anchor() and site_url() ?
#4

[eluser]bretticus[/eluser]
Well, it appears form the manual that site_url() just prints a url out prepending your website to whatever you send as the parameter:

echo site_url("news/local/123");

The above example would return something like: http://example.com/index.php/news/local/123

anchor("news/local/123", "click here"); builds out the surrounding html a tag in addition...

The above example would return something like:
Code:
<a href="http://example.com/index.php/news/local/123">click here</a>
#5

[eluser]mdcode[/eluser]
Many Thanks bretticus... I have the url helper automatically loaded and with a little playing around it's come up with the correct text and link... Not sure if the link works yet and brings up the form, I'm just excited that the link is displaying correctly.




Theme © iAndrew 2016 - Forum software by © MyBB