  |
1 | 1 | | <?php |
| |
2 | 2 | | /* |
  |
3 | | - | $Id: template.php 593 2006-07-03 09:07:11Z hpdl $ |
| |
| 3 | + | $Id: template.php 629 2006-07-18 14:45:08Z hpdl $ |
|
4 | 4 | | |
| |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
|
|
 |
… |
|
219 | 219 | | * @return string |
| |
220 | 220 | | */ |
| |
221 | 221 | | |
  |
222 | | - | function getCode() { |
| |
| 222 | + | function getCode($id = null) { |
|
223 | 223 | | if (isset($this->_template) === false) { |
| |
224 | 224 | | $this->set(); |
| |
225 | 225 | | } |
| |
226 | 226 | | |
  |
227 | | - | return $this->_template; |
| |
| 227 | + | if (is_numeric($id)) { |
| |
| 228 | + | foreach ($this->getTemplates() as $template) { |
| |
| 229 | + | if ($template['id'] == $id) { |
| |
| 230 | + | return $template['code']; |
| |
| 231 | + | } |
| |
| 232 | + | } |
| |
| 233 | + | } else { |
| |
| 234 | + | return $this->_template; |
| |
| 235 | + | } |
|
228 | 236 | | } |
| |
229 | 237 | | |
| |
230 | 238 | | /** |
| |
|
|
 |
… |
|
368 | 376 | | $Qtemplates->execute(); |
| |
369 | 377 | | |
| |
370 | 378 | | while ($Qtemplates->next()) { |
  |
371 | | - | $templates [] = $Qtemplates->toArray(); |
| |
| 379 | + | $templates[] = $Qtemplates->toArray(); |
  |
372 | 380 | | } |
| |
373 | 381 | | |
| |
374 | 382 | | $Qtemplates->freeResult(); |