New! TypeRocket v5 is now available. See docs.
Access all of Typerocket. Get Pro.
Front-end Mode
( v4 )
Enable Front-end Mode
To enable front-end mode set the frontend.assets
value to true
in config/typerocket.php
; it is false
by default. This will add the TypeRocket required JavaScript and CSS to the front end of your theme.
/*
|--------------------------------------------------------------------------
| Frontend
|--------------------------------------------------------------------------
|
| Determine frontend settings
|
*/
'frontend' => [
'assets' => true,
],
You can now use TypeRocket on the front-end of your site.
Front-end Forms
You can use a form on the front-end of your site and have it submit to a custom route. To do this you need to create a Form
and assign it to a URL.
For example, if you have the following route in your routes.php
file.
tr_route()->put()->match('/seats/(*.)/', 'update@Seat')
Then, in your template or view file wrap the following code in an element with the class .typerocket-container
.
// A form is best created in a controller
// and passed to a view.
$id = 1;
$form = tr_form('seat', $id);
$form->useURL( 'update', '/seats/'.$id.'/' );
// Print to the view
echo $form->open();
echo $form->text('Number');
echo $form->text('Price');
echo $form->submit('Update Seat');
echo $form->close();
Found a typo? Something is wrong in this documentation? Fork and edit it!