Passed
Branch master (31be8b)
by Gino
03:04
created

TDMCreateHtmlSmartyCodes::getHtmlParagraph()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 9
rs 9.6666
cc 2
eloc 6
nc 2
nop 2
1
<?php
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
/**
13
 * tdmcreate module.
14
 *
15
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
16
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 *
18
 * @since           2.5.0
19
 *
20
 * @author          Txmod Xoops http://www.txmodxoops.org
21
 *
22
 * @version         $Id: TDMCreateHtmlSmartyCodes.php 12258 2014-01-02 09:33:29Z timgno $
23
 */
24
25
/**
26
 * Class TDMCreateHtmlSmartyCodes.
27
 */
28
class TDMCreateHtmlSmartyCodes extends TDMCreateFile
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
29
{
30
    /*
31
    * @var string
32
    */
33
    protected $htmlcode;
34
35
    /*
36
    *  @public function constructor
37
    *  @param null
38
    */
39
    /**
40
     *
41
     */
42
    public function __construct()
43
    {
44
        parent::__construct();
45
    }
46
47
    /*
48
    *  @static function &getInstance
49
    *  @param null
50
    */
51
    /**
52
     * @return TDMCreateHtmlSmartyCodes
53
     */
54
    public static function &getInstance()
55
    {
56
        static $instance = false;
57
        if (!$instance) {
58
            $instance = new self();
59
        }
60
61
        return $instance;
62
    }
63
64
    /*
65
    *  @public function getHtmlTag
66
    *  @param string $tag
67
    *  @param array  $attributes
68
    *  @param string $content
69
    *  @param bool   $closed
70
    */
71
    /**
72
     * @param $tag
73
     * @param $attributes
74
     * @param $content
75
     * @param $closed
76
     *
77
     * @return string
78
     */
79
    public function getHtmlTag($tag = '', $attributes = array(), $content = '', $closed = true)
80
    {
81
        if (empty($attributes)) {
82
            $attributes = array();
83
        }
84
        $attr = $this->getAttributes($attributes);
85
        if (!$closed) {
86
            $ret = "<{$tag}{$attr} />";
87
        } else {
88
            $ret = "<{$tag}{$attr}>{$content}</{$tag}>";
89
        }
90
91
        return $ret;
92
    }
93
94
     /*
95
    *  @private function setAttributes
96
    *  @param array $attributes
97
    */
98
    /**
99
     * @param  $attributes
100
     *
101
     * @return string
102
     */
103
    private function getAttributes($attributes)
104
    {
105
        $str = '';
106
        foreach ($attributes as $name => $value) {
107
            if ($name != '_') {
108
                $str .= ' '.$name.'="'.$value.'"';
109
            }
110
        }
111
112
        return $str;
113
    }
114
115
    /*
116
    *  @public function getHtmlEmpty
117
    *  @param string $empty
118
    */
119
    /**
120
     * @param $empty
121
     *
122
     * @return string
123
     */
124
    public function getHtmlEmpty($empty = '')
125
    {
126
        return "{$empty}";
127
    }
128
129
    /*
130
    *  @public function getHtmlComment
131
    *  @param string $htmlComment
132
    */
133
    /**
134
     * @param $htmlComment
135
     *
136
     * @return string
137
     */
138
    public function getHtmlComment($htmlComment = '')
139
    {
140
        return "<!-- {$htmlComment} -->";
141
    }
142
143
    /*
144
    *  @public function getHtmlBr
145
    *  @param string $brNumb
146
    *  @param string $class
147
    */
148
    /**
149
     * @param $brNumb
150
     * @param $class
151
     *
152
     * @return string
153
     */
154
    public function getHtmlBr($brNumb = 1, $htmlClass = '')
155
    {
156
        $brClass = ($htmlClass != '') ? " class='{$htmlClass}'" : '';
157
        $ret = '';
158
        for ($i = 0; $i < $brNumb; ++$i) {
159
            $ret .= "<br{$brClass} />";
160
        }
161
162
        return $ret;
163
    }
164
165
    /*
166
    *  @public function getHtmlHNumb
167
    *  @param string $htmlHClass
168
    *  @param string $content
169
    */
170
    /**
171
     * @param $content
172
     * @param $htmlHClass
173
     *
174
     * @return string
175
     */
176
    public function getHtmlHNumb($content = '', $n = '1', $htmlHClass = '')
177
    {
178
        $hClass = ($htmlHClass != '') ? " class='{$htmlHClass}'" : '';
179
        $ret = "<h{$n}{$hClass}>{$content}</h{$n}>";
180
181
        return $ret;
182
    }
183
184
    /*
185
    *  @public function getHtmlDiv
186
    *  @param string $class
187
    *  @param string $content
188
    */
189
    /**
190
     * @param $content
191
     * @param $class
192
     *
193
     * @return string
194
     */
195
    public function getHtmlDiv($content = '', $divClass = '')
196
    {
197
        $rDivClass = ($divClass != '') ? " class='{$divClass}'" : '';
198
        $ret = "<div{$rDivClass}>\n";
199
        $ret .= "\t{$content}\n";
200
        $ret .= "</div>\n";
201
202
        return $ret;
203
    }
204
205
    /*
206
    *  @public function getHtmlPre
207
    *  @param string $class
208
    *  @param string $content
209
    */
210
    /**
211
     * @param $content
212
     * @param $class
213
     *
214
     * @return string
215
     */
216
    public function getHtmlPre($content = '', $preClass = '')
217
    {
218
        $rPreClass = ($preClass != '') ? " class='{$preClass}'" : '';
219
        $ret = "<pre{$rPreClass}>\n";
220
        $ret .= "\t{$content}\n";
221
        $ret .= "</pre>\n";
222
223
        return $ret;
224
    }
225
226
    /*
227
    *  @public function getHtmlSpan
228
    *  @param string $class
229
    *  @param string $content
230
    */
231
    /**
232
     * @param $content
233
     * @param $class
234
     *
235
     * @return string
236
     */
237
    public function getHtmlSpan($content = '', $spanClass = '')
238
    {
239
        $rSpanClass = ($spanClass != '') ? " class='{$spanClass}'" : '';
240
        $ret = "<span{$rSpanClass}>{$content}</span>";
241
242
        return $ret;
243
    }
244
245
    /*
246
    *  @public function getHtmlParagraph
247
    *  @param string $class
248
    *  @param string $content
249
    */
250
    /**
251
     * @param $content
252
     * @param $class
253
     *
254
     * @return string
255
     */
256
    public function getHtmlParagraph($content = '', $pClass = '')
257
    {
258
        $rPClass = ($pClass != '') ? " class='{$pClass}'" : '';
259
        $ret = "<p{$rPClass}>\n";
260
        $ret .= "\t{$content}\n";
261
        $ret .= "</p>\n";
262
263
        return $ret;
264
    }
265
266
    /*
267
    *  @public function getHtmlI
268
    *  @param string $class
269
    *  @param string $content
270
    */
271
    /**
272
     * @param $content
273
     * @param $class
274
     *
275
     * @return string
276
     */
277
    public function getHtmlI($content = '', $iClass = '')
278
    {
279
        $rIClass = ($iClass != '') ? " class='{$iClass}'" : '';
280
        $ret = "<i{$rIClass}>{$content}</i>";
281
282
        return $ret;
283
    }
284
285
    /*
286
    *  @public function getHtmlUl
287
    *  @param string $class
288
    *  @param string $content
289
    */
290
    /**
291
     * @param $content
292
     * @param $class
293
     *
294
     * @return string
295
     */
296
    public function getHtmlUl($content = '', $ulClass = '')
297
    {
298
        $rUlClass = ($ulClass != '') ? " class='{$ulClass}'" : '';
299
        $ret = "<ul{$rUlClass}>\n";
300
        $ret .= "\t{$content}\n";
301
        $ret .= "</ul>\n";
302
303
        return $ret;
304
    }
305
306
    /*
307
    *  @public function getHtmlOl
308
    *  @param string $class
309
    *  @param string $content
310
    */
311
    /**
312
     * @param $content
313
     * @param $class
314
     *
315
     * @return string
316
     */
317
    public function getHtmlOl($content = '', $olClass = '')
318
    {
319
        $rOlClass = ($olClass != '') ? " class='{$olClass}'" : '';
320
        $ret = "<ol{$rOlClass}>\n";
321
        $ret .= "\t{$content}\n";
322
        $ret .= "</ol>\n";
323
324
        return $ret;
325
    }
326
327
    /*
328
    *  @public function getHtmlLi
329
    *  @param string $class
330
    *  @param string $content
331
    */
332
    /**
333
     * @param $content
334
     * @param $class
335
     *
336
     * @return string
337
     */
338
    public function getHtmlLi($content = '', $liClass = '')
339
    {
340
        $rLiClass = ($liClass != '') ? " class='{$liClass}'" : '';
341
342
        return "<li{$rLiClass}>{$content}</li>";
343
    }
344
345
    /*
346
    *  @public function getHtmlStrong
347
    *  @param string $class
348
    *  @param string $content
349
    */
350
    /**
351
     * @param $content
352
     * @param $class
353
     *
354
     * @return string
355
     */
356
    public function getHtmlStrong($content = '', $strongClass = '')
357
    {
358
        $rStrongClass = ($strongClass != '') ? " class='{$strongClass}'" : '';
359
360
        return "<strong{$rStrongClass}>{$content}</strong>";
361
    }
362
363
    /*
364
    *  @public function getHtmlAnchor
365
    *  @param string $class
366
    *  @param string $url
367
    *  @param string $target
368
    *  @param string $content
369
    */
370
    /**
371
     * @param $url
372
     * @param $content
373
     * @param $target
374
     * @param $class
375
     *
376
     * @return string
377
     */
378
    public function getHtmlAnchor($url = '#', $content = '&nbsp;', $title = '', $target = '', $aClass = '', $rel = '')
379
    {
380
        $target = ($target != '') ? " target='{$target}'" : '';
381
        $rAClass = ($aClass != '') ? " class='{$aClass}'" : '';
382
        $rel = ($rel != '') ? " rel='{$rel}'" : '';
383
384
        return "<a{$rAClass} href='{$url}' title='{$title}'{$target}{$rel}>{$content}</a>";
385
    }
386
387
    /*
388
    *  @public function getHtmlImage
389
    *  @param string $src
390
    *  @param string $alt
391
    *  @param string $class
392
    */
393
    /**
394
     * @param $src
395
     * @param $alt
396
     * @param $class
397
     *
398
     * @return string
399
     */
400
    public function getHtmlImage($src = 'blank.gif', $alt = 'blank.gif', $imgClass = '')
401
    {
402
        $rImgClass = ($imgClass != '') ? " class='{$imgClass}'" : '';
403
        $ret = "<img{$rImgClass} src='{$src}' alt='{$alt}' />";
404
405
        return $ret;
406
    }
407
408
    /*
409
    *  @public function getHtmlTable
410
    *  @param string $class
411
    *  @param string $content
412
    */
413
    /**
414
     * @param $content
415
     * @param $class
416
     *
417
     * @return string
418
     */
419
    public function getHtmlTable($content = '', $tableClass = '')
420
    {
421
        $rTableClass = ($tableClass != '') ? " class='{$tableClass}'" : '';
422
        $ret = "<table{$rTableClass}>\n";
423
        $ret .= "\t{$content}\n";
424
        $ret .= "</table>\n";
425
426
        return $ret;
427
    }
428
429
    /*
430
    *  @public function getHtmlTableThead
431
    *  @param string $class
432
    *  @param string $content
433
    */
434
    /**
435
     * @param $content
436
     * @param $class
437
     *
438
     * @return string
439
     */
440
    public function getHtmlTableThead($content = '', $theadClass = '')
441
    {
442
        $rTheadClass = ($theadClass != '') ? " class='{$theadClass}'" : '';
443
        $ret = "\t<thead{$rTheadClass}>\n";
444
        $ret .= "\t\t{$content}\n";
445
        $ret .= "\t</thead>\n";
446
447
        return $ret;
448
    }
449
450
    /*
451
    *  @public function getHtmlTableTbody
452
    *  @param string $class
453
    *  @param string $content
454
    */
455
    /**
456
     * @param $content
457
     * @param $class
458
     *
459
     * @return string
460
     */
461
    public function getHtmlTableTbody($content = '', $tbodyClass = '')
462
    {
463
        $rTbodyClass = ($tbodyClass != '') ? " class='{$tbodyClass}'" : '';
464
        $ret = "\t<tbody{$rTbodyClass}>\n";
465
        $ret .= "\t\t{$content}\n";
466
        $ret .= "\t</tbody>\n";
467
468
        return $ret;
469
    }
470
471
    /*
472
    *  @public function getHtmlTableTfoot
473
    *  @param string $class
474
    *  @param string $content
475
    */
476
    /**
477
     * @param $content
478
     * @param $class
479
     *
480
     * @return string
481
     */
482
    public function getHtmlTableTfoot($content = '', $tfootClass = '')
483
    {
484
        $rTfootClass = ($tfootClass != '') ? " class='{$tfootClass}'" : '';
485
        $ret = "\t<tfoot{$rTfootClass}>\n";
486
        $ret .= "\t\t{$content}\n";
487
        $ret .= "\t</tfoot>\n";
488
489
        return $ret;
490
    }
491
492
    /*
493
    *  @public function getHtmlTableRow
494
    *  @param string $class
495
    *  @param string $content
496
    */
497
    /**
498
     * @param $content
499
     * @param $class
500
     *
501
     * @return string
502
     */
503
    public function getHtmlTableRow($content = '', $trClass = '')
504
    {
505
        $rTrClass = ($trClass != '') ? " class='{$trClass}'" : '';
506
        $ret = "\t<tr{$rTrClass}>\n";
507
        $ret .= "\t\t{$content}\n";
508
        $ret .= "\t</tr>\n";
509
510
        return $ret;
511
    }
512
513
    /*
514
    *  @public function getHtmlTableHead
515
    *  @param string $class
516
    *  @param string $content
517
    */
518
    /**
519
     * @param $content
520
     * @param $class
521
     * @param $colspan
522
     *
523
     * @return string
524
     */
525
    public function getHtmlTableHead($content = '', $thClass = '', $colspan = '')
526
    {
527
        $rThClass = ($thClass != '') ? " class='{$thClass}'" : '';
528
        $colspan = ($colspan != '') ? " colspan='{$colspan}'" : '';
529
530
        return "<th{$colspan}{$rThClass}>{$content}</th>";
531
    }
532
533
    /*
534
    *  @public function getHtmlTableData
535
    *  @param string $class
536
    *  @param string $content
537
    */
538
    /**
539
     * @param $content
540
     * @param $class
541
     * @param $colspan
542
     *
543
     * @return string
544
     */
545
    public function getHtmlTableData($content = '', $tdClass = '', $colspan = '')
546
    {
547
        $rTdClass = ($tdClass != '') ? " class='{$tdClass}'" : '';
548
        $colspan = ($colspan != '') ? " colspan='{$colspan}'" : '';
549
550
        return "<td{$colspan}{$rTdClass}>{$content}</td>";
551
    }
552
553
    /*
554
    *  @public function getSmartyComment
555
    *  @param string $comment
556
    */
557
    /**
558
     * @param $comment
559
     *
560
     * @return string
561
     */
562
    public function getSmartyComment($comment = '')
0 ignored issues
show
Unused Code introduced by
The parameter $comment is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
563
    {
564
        return "<{* {$content} *}>";
0 ignored issues
show
Bug introduced by
The variable $content does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
565
    }
566
567
    /*
568
    *  @public function getSmartyNoSimbol
569
    *  @param string $content
570
    */
571
    /**
572
     * @param $content
573
     *
574
     * @return string
575
     */
576
    public function getSmartyNoSimbol($noSimbol = '')
577
    {
578
        return "<{{$noSimbol}}>";
579
    }
580
581
    /*
582
    *  @public function getSmartyConst
583
    *  @param string $language
584
    *  @param mixed $const
585
    */
586
    /**
587
     * @param $language
588
     * @param $const
589
     *
590
     * @return string
591
     */
592
    public function getSmartyConst($language, $const)
593
    {
594
        return "<{\$smarty.const.{$language}{$const}}>";
595
    }
596
597
    /*
598
    *  @public function getSmartySingleVar
599
    *  @param string $var
600
    */
601
    /**
602
     * @param string $var
603
     *
604
     * @return string
605
     */
606
    public function getSmartySingleVar($var)
607
    {
608
        return "<{\${$var}}>";
609
    }
610
611
    /*
612
    *  @public function getSmartyDoubleVar
613
    *  @param string $leftVar
614
    *  @param string $rightVar
615
    */
616
    /**
617
     * @param string $leftVar
618
     * @param string $rightVar
619
     *
620
     * @return string
621
     */
622
    public function getSmartyDoubleVar($leftVar, $rightVar)
623
    {
624
        return "<{\${$leftVar}.{$rightVar}}>";
625
    }
626
627
    /*
628
    *  @public function getSmartyIncludeFile
629
    *  @param string $name
630
    */
631
    /**
632
     * @param $moduleDirname
633
     * @param $fileName
634
     * @param $admin
635
     *
636
     * @return string
637
     */
638
    public function getSmartyIncludeFile($moduleDirname, $fileName = 'header', $admin = false, $q = false)
639
    {
640
        if (!$admin && !$q) {
641
            $ret = "<{include file='db:{$moduleDirname}_{$fileName}.tpl'}>\n";
642
        } elseif ($admin && !$q) {
643
            $ret = "<{include file='db:{$moduleDirname}_admin_{$fileName}.tpl'}>\n";
644
        } elseif (!$admin && $q) {
645
            $ret = "<{includeq file='db:{$moduleDirname}_{$fileName}.tpl'}>\n";
646
        } elseif ($admin && $q) {
647
            $ret = "<{includeq file='db:{$moduleDirname}_admin_{$fileName}.tpl'}>\n";
648
        }
649
650
        return $ret;
0 ignored issues
show
Bug introduced by
The variable $ret does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
651
    }
652
653
    /*
654
    *  @public function getSmartyIncludeFileListSection
655
    *  @param string $name
656
    */
657
    /**
658
     * @param $moduleDirname
659
     * @param $fileName
660
     * @param $tableFieldName
661
     *
662
     * @return string
663
     */
664
    public function getSmartyIncludeFileListSection($moduleDirname, $fileName, $tableFieldName)
665
    {
666
        return "<{include file='db:{$moduleDirname}_{$fileName}_list.tpl' {$tableFieldName}=\${$tableFieldName}[i]}>";
667
    }
668
669
    /*
670
    *  @public function getSmartyIncludeFileListForeach
671
    *  @param string $name
672
    */
673
    /**
674
     * @param $moduleDirname
675
     * @param $fileName
676
     * @param $tableFieldName
677
     *
678
     * @return string
679
     */
680
    public function getSmartyIncludeFileListForeach($moduleDirname, $fileName, $tableFieldName)
681
    {
682
        return "<{include file='db:{$moduleDirname}_{$fileName}_list.tpl' {$tableFieldName}=\${$tableFieldName}}>";
683
    }
684
685
    /*
686
    *  @public function getSmartyConditions
687
    *  @param string $condition
688
    *  @param string $operator
689
    *  @param string $type
690
    *  @param string $contentIf
691
    *  @param mixed  $contentElse
692
    *  @param bool   $count
693
    */
694
    /**
695
     * @param string $condition
696
     * @param string $operator
697
     * @param string $type
698
     * @param string $contentIf
699
     * @param mixed  $contentElse
700
     * @param bool   $count
701
     *
702
     * @return string
703
     */
704
    public function getSmartyConditions($condition = '', $operator = '', $type = '', $contentIf = '', $contentElse = false, $count = false, $noSimbol = false)
705
    {
706
        if (!$contentElse) {
707
            if (!$count) {
708
                $ret = "<{if \${$condition}{$operator}{$type}}>\n";
709
            } elseif (!$noSimbol) {
710
                $ret = "<{if {$condition}{$operator}{$type}}>\n";
711
            } else {
712
                $ret = "<{if count(\${$condition}){$operator}{$type}}>\n";
713
            }
714
            $ret .= "\t{$contentIf}\n";
715
            $ret .= "<{/if}>\n";
716
        } else {
717
            if (!$count) {
718
                $ret = "<{if \${$condition}{$operator}{$type}}>\n";
719
            } elseif (!$noSimbol) {
720
                $ret = "<{if {$condition}{$operator}{$type}}>\n";
721
            } else {
722
                $ret = "<{if count(\${$condition}){$operator}{$type}}>\n";
723
            }
724
            $ret .= "\t{$contentIf}\n";
725
            $ret .= "<{else}>\n";
726
            $ret .= "\t{$contentElse}\n";
727
            $ret .= "<{/if}>\n";
728
        }
729
730
        return $ret;
731
    }
732
733
    /*
734
    *  @public function getSmartyForeach
735
    *  @param string $item
736
    *  @param string $from
737
    *  @param string $content
738
    */
739
    /**
740
     * @param string $item
741
     * @param string $from
742
     * @param string $content
743
     *
744
     * @return string
745
     */
746
    public function getSmartyForeach($item = 'item', $from = 'from', $content = 'content', $name = '', $key = '')
747
    {
748
        $name = $name != '' ? " name={$name}" : '';
749
        $key = $key != '' ? " key={$key}" : '';
750
        $ret = "<{foreach item={$item} from=\${$from}{$key}{$name}}>\n";
751
        $ret .= "\t{$content}\n";
752
        $ret .= "<{/foreach}>\n";
753
754
        return $ret;
755
    }
756
757
    /*
758
    *  @public function getSmartyForeachQuery
759
    *  @param string $item
760
    *  @param string $from
761
    *  @param string $content
762
    */
763
    /**
764
     * @param string $item
765
     * @param string $from
766
     * @param string $content
767
     *
768
     * @return string
769
     */
770
    public function getSmartyForeachQuery($item = 'item', $from = 'from', $content = 'content', $loop = 'loop', $key = '')
771
    {
772
        $loop = $loop != '' ? " loop={$loop}" : '';
773
        $key = $key != '' ? " key={$key}" : '';
774
        $ret = "<{foreachq item={$item} from=\${$from}{$key}{$loop}}>\n";
775
        $ret .= "\t{$content}\n";
776
        $ret .= "<{/foreachq}>\n";
777
778
        return $ret;
779
    }
780
781
    /*
782
    *  @public function getSmartySection
783
    *  @param string $name
784
    *  @param string $loop
785
    *  @param string $content
786
    */
787
    /**
788
     * @param string $name
789
     * @param string $loop
790
     * @param string $content
791
     *
792
     * @return string
793
     */
794
    public function getSmartySection($name = 'name', $loop = 'loop', $content = 'content', $start = 0, $step = 0)
795
    {
796
        $start = $start != 0 ? " start={$start}" : '';
797
        $step = $step != 0 ? " step={$step}" : '';
798
        $ret = "<{section name={$name} loop=\${$loop}{$start}{$step}}>\n";
799
        $ret .= "\t{$content}\n";
800
        $ret .= "<{/section}>\n";
801
802
        return $ret;
803
    }
804
}
805