1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need ViewPublic Help

Discussion in 'XenForo' started by vOlLvEriNe, Jun 3, 2015.

  1. #1
    Hello Everybody,
    I'm Trying to Create a plugin, And stuck in ViewPublic :(
    How Can I Show List Of Posts Via ViewPublic ?
    Please Fix My Code
    class Custom_ViewPublic_Index extends XenForo_ViewPublic_Base
    {
        public function renderHtml()
        {
            $db = XenForo_Application::get('db');
            $sql = $db->fetchAll("SELECT * FROM custom_item");
            foreach ($sql as $item) {
    
                //What to Do
    
            }
        }
    }
    PHP:
    I Have to Show Like This
    <ul>
    <li>Title Num 1</li>
    <li>Title Num 2</li>
    <li>Title Num 3</li>
    </ul>
    SEMrush
     
    vOlLvEriNe, Jun 3, 2015 IP
    SEMrush
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,198
    Likes Received:
    2,584
    Best Answers:
    457
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    Well first of all, you shouldn't be doing queries within a view... rather you should be doing queries within your model and passing the results to your view.
     
    digitalpoint, Jun 7, 2015 IP