Class Hotkeywidget extends Widget {
Public function render ($data) {
$node =m (' Hotkey ');//This is the instantiation of a database table
$data = $node->limit (' 0,10 ')->select ();
$data [' list ']= $data;
$content = $this->renderfile (addon_path. '/widgets/hotkey.html ', $data);
return $content;
}
}
How should I call the data read in the Hotkeywidget class in hotket.html? What should I call if I apply it to a template?
Reply to discussion (solution)
Would you use thinkphp, wouldn't you use a custom?
The same answer ~ ~ ~ Upstairs there is no problem ah.
I also met with the same?? ...
1.widget is generally placed in the Lib directory, such as the leaderboard widget, creating files TopLankWidget.class.php and toplank.html
2. Write the method on the PHP page about the leaderboard, calling {: W (' Toplank ', Array (' ' type ' = ' = ' "'" ') ' on the page}
Call the read-out data:
{$L [' goods_id ']}
{$L [' category ']}
{$L [' sort ']}
{$L [' store_id ']}
{$L [' Goods_name ']}
{$L [' Price ']}
{$L [' desc ']}
{$L [' img ']}
Template calls
{: W (' Hotkey ')}