Welcome Guest, Not a member yet? Register   Sign In
Anchor setup wih a php echo
#3

(This post was last modified: 07-08-2019, 06:17 AM by Wouter60.)

Anchor is a CI helper function.
Your question proves that your website does not follow the CI architecture.
In CI, all url's are handled by index.php, so you never address php files directly, just controller classes and methods inside controllers.
Anchor will include CI's site_url automatically.

Example:
Controller: Products
Method: save_product()
Argument for the method: the id of the given product.

PHP Code:
<?= anchor('products/save_product/' $id'Save''class="btn btn-warning"');?>

The first argument is the url.
The second argument is the caption for the button (visible text).
The third argument is an optional string with options. If you need an "onclick" attribute, you can include it in the string, or you can use an array.

First, rebuild your application from traditional flat php to the Model-View-Controller structure that CI is using.
Reply


Messages In This Thread
Anchor setup wih a php echo - by Mekaboo - 07-07-2019, 08:11 PM
RE: Anchor setup wih a php echo - by neuron - 07-08-2019, 01:35 AM
RE: Anchor setup wih a php echo - by Mekaboo - 07-08-2019, 05:30 PM
RE: Anchor setup wih a php echo - by Wouter60 - 07-08-2019, 05:32 AM
RE: Anchor setup wih a php echo - by Mekaboo - 07-08-2019, 05:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB