php - Using $this when not in object context -


I am creating a function to show the blog. That's why I created a show blog function but it returns the "use of $ if the object is not in context" error

  class blog {public function getLatestBlogsBig ($ cat = null) {$ sqlString = "SELECT Blog_id FROM jab_blog"; If ($ cat! = Zero) $ sqlString = "WHERE blog_cat =" $ cat; $ SqlString = "ORDER BY blog_id DESC LIMIT 5"; $ Blog = mysql_query ($ sqlString); While ($ id = mysql_result ($ blog, "blog_id")) {$ this- & gt; Showblog ($ id); // error is on this line}} showblog ($ id, $ small = false) {$ sqlString = "SELECT blog_id FROM jab_blog WHERE blog_id ="} $ Id ","; $ Blog = mysql_query ($ sqlString); If ($ small = true) {echo " ul>"; While ($ blogItem = mysql_fetch_array ($ blog)) {echo '& lt; A href = "'. $ _SESSION [' jab_LINK ']. Blog /". $ BlogItem ['blog_id'] "/". SimpleUrl :: ToAscii ($ blogItem ['blog_title']) '& Gt;' . $ Blogite ['blog' title ']' & lt; / A & gt; & Lt; / Li & gt; '; Echo "& lt; / ul & gt;"; } And {while ($ blogItem = mysql_fetch_array ($ blog))? & Gt; & Lt; Div class = "post" & gt; & Lt; H2 class = "title" & gt; & Lt; A href = "& lt ;? php echo $ _SESSION ['jab_LINK']. Blog /". $ Blog item ['blog_id']. "/". SimpleUrl :: toAscii ($ BlogItem ['blog_title']) ;? & Gt; "& Gt; & lt ;? php echo $ blog item ['blog' title]]? & Gt; & lt; / a & gt; & lt; / h2 & gt; & lt; p class =" meta "& Gt; & lt; span class = "date" & gt; date implementation & lt; / span & gt; & lt; span class = "posted" & gt; & lt; a href = "#" & gt; Lieutenant; / a & gt; & lt; / span & gt; & lt; / p & gt; & lt; div style = "clear: both;" & gt; & amp; nbsp; & lt; / div & gt; ; & Lt; div class = "entry">  echo $ blog item ['blog_content'];? & Gt; & lt; / div & gt; & lt; / div & gt; & lt; ? Php}}}  

if you getLatestBlogsBig ? You are calling it in a static context ( blog :: getLatestBlogsBig () ) If you do not have an address in $ this , then you need to call the getLatestBlogsBig method on the blog class. < / P>


Comments