Prev | Current Page 399 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

Let??™s see how the admin_departments.tpl template works.
Here??™s a scheme of the {section} construct used to build the rows of the department table:
{section name=i loop=$obj->mDepartments}
{if $obj->mEditItem == $obj->mDepartments[i].department_id}

{else}

{/if}
{/section}
By default, the department name and description are not editable, but when you click the Edit button of one
department, $obj->mEditItem is set to the department_id value of the clicked department, and the Smarty
presentation logic generates editable text boxes instead of labels. This will allow the administrator to edit the selected
department??™s details (in edit mode, Update/Cancel buttons appear instead of the Edit button, as you saw in the earlier
figures).
CHAPTER 10 ?–  CATALOG ADMINISTRATION: DEPARTMENTS AND CATEGORIES 291
The presentation object of admin_departments??”AdminDepartments??”contains the logic that makes the
departments administration page work. If loaded as a result of the user clicking one of the buttons (such as the
Edit or Delete buttons), it checks what button was clicked and reacts accordingly.


Pages:
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
pustaki szklane House Extension Kąty Rybackie noclegi kasyno Kołobrzeg