simpleAdminPlus v1.0

Getting Started

Click on a title to show the code.

Working with a database

This code will select 4 rows from the products table, display their title, and create the paging links.

<?php $products = $simpleAdmin->get_rows('products', '', 4) ?>
<?php foreach( $products as $product ) : ?>
	<h2><?= $product->title ?></h2>
<?php endforeach ?>

<?php $simpleAdmin->paging_links('products', '', array(
		'next_text' => '>',
		'prev_text' => '<'
	)) ?>

Creating a Form

This code will create a form, and auto fill the form with the values from the third row in the products table.

<?php $form = $simpleAdmin->form->form_for('products', 3) ?>
<form method="post">

	<div class="input_field">
		<?= $form->label('title') ?>
		<?= $form->input_box('title') ?>
	</div>

	<div class="input_field">
		<?= $form->label('description') ?>
		<?= $form->text_box('description') ?>
	</div>

	<div class="input_field">
		<?= $form->label('category_id', 'Category') ?>
		<?= $form->select_box('category_id', 'categories', 'id', 'name') ?>
	</div>

	<?= $form->submit('Add Product') ?>
</form>

Loading, Resizing, and Converting an Image

This code will load, resize, and convert an image on the fly.

<?php
// Open an image
$simpleAdmin->image->load('../images/logo.png');

// Resize the image to thumbnail width
// And maintain aspect ratio
$simpleAdmin->image->resize_to_width(150);

// Save the image as a jpeg
$simpleAdmin->image->save('../images/image_thumb.jpg')
?>