Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
PHP News Help
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Kodys" data-source="post: 390774" data-attributes="member: 71959"><p>There's two solutions, the first one is if you're using <strong>$_GET['id']</strong> in the news.php file and the second is if you're not. (Most likely use the second method)</p><p>[spoiler=First]</p><p>As I have no idea at all what you've named the variable you're using if you'll have to change <strong>$changeme</strong> in the code I've wrote to the variable.</p><p>[code=PHP]</p><p> $author= mysql_query("SELECT * FROM users WHERE username = ".$changeme['author']);</p><p> echo '<div id="userAvatar" style="margin-bottom: 10px;;float:left;width: 75px;height:70px;background: url(http://avatar-retro.com/habbo-imaging/avatarimage?figure='.$author['look'].'&amp;action=drk&amp;direction=3&amp;head_direction=3&amp;gesture=sml&amp;size=1) no-repeat;"></div></p><p> <div id="slickTitle" style="margin-top:17px;" class="newsAuthor"><a href="/home/'.$author['username'].'" style="text-decoration:none;color:#666;">'.$author['username'].'</a><span class="newstext"><b>{newsDate}</b></span></div></p><p>[/code]</p><p>[/spoiler]</p><p>[spoiler=Second]</p><p>In class.forms.php located in app/tpl/ you can replace the getPageNews function with the following below.</p><p>[code=PHP]</p><p>final public function getPageNews()</p><p> {</p><p> global $template, $engine;</p><p> </p><p> if(!isset($_GET['id']) || !is_numeric($_GET['id']))</p><p> {</p><p> $_GET['id'] = 1;</p><p> }</p><p> $result = mysql_query("SELECT title, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC");</p><p> </p><p> while($news1 = mysql_fetch_array($result))</p><p> {</p><p> $template->setParams('newsList', '&laquo; <a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '</a><br/>');</p><p> }</p><p> </p><p> $news = $engine->fetch_assoc("SELECT title, longstory, author, published FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");</p><p> $author = $engine->fetch_assoc("SELECT look FROM users WHERE username = ".$news['author']." LIMIT 1");</p><p> $template->setParams('newsTitle', $news['title']);</p><p> $template->setParams('newsContent', $news['longstory']);</p><p> $template->setParams('newsAuthor', $news['author']);</p><p> $template->setParams('newsDate', date("d-m-y", $news['published']));</p><p> $template->setParams('authorLook', $author['look']);</p><p> </p><p> unset($result);</p><p> unset($news1);</p><p> unset($news);</p><p> }</p><p>[/code]</p><p>This would allow you to use {authorLook} to show their look in your current code. Instead of using $onlineRow['look'].[/spoiler]</p><p><em>Just something to point out is that when you're creating a link to their home page you're using {username} when you should be using {newsAuthor}.</em></p></blockquote><p></p>
[QUOTE="Kodys, post: 390774, member: 71959"] There's two solutions, the first one is if you're using [B]$_GET['id'][/B] in the news.php file and the second is if you're not. (Most likely use the second method) [spoiler=First] As I have no idea at all what you've named the variable you're using if you'll have to change [B]$changeme[/B] in the code I've wrote to the variable. [code=PHP] $author= mysql_query("SELECT * FROM users WHERE username = ".$changeme['author']); echo '<div id="userAvatar" style="margin-bottom: 10px;;float:left;width: 75px;height:70px;background: url(http://avatar-retro.com/habbo-imaging/avatarimage?figure='.$author['look'].'&action=drk&direction=3&head_direction=3&gesture=sml&size=1) no-repeat;"></div> <div id="slickTitle" style="margin-top:17px;" class="newsAuthor"><a href="/home/'.$author['username'].'" style="text-decoration:none;color:#666;">'.$author['username'].'</a><span class="newstext"><b>{newsDate}</b></span></div> [/code] [/spoiler] [spoiler=Second] In class.forms.php located in app/tpl/ you can replace the getPageNews function with the following below. [code=PHP] final public function getPageNews() { global $template, $engine; if(!isset($_GET['id']) || !is_numeric($_GET['id'])) { $_GET['id'] = 1; } $result = mysql_query("SELECT title, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC"); while($news1 = mysql_fetch_array($result)) { $template->setParams('newsList', '« <a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '</a><br/>'); } $news = $engine->fetch_assoc("SELECT title, longstory, author, published FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1"); $author = $engine->fetch_assoc("SELECT look FROM users WHERE username = ".$news['author']." LIMIT 1"); $template->setParams('newsTitle', $news['title']); $template->setParams('newsContent', $news['longstory']); $template->setParams('newsAuthor', $news['author']); $template->setParams('newsDate', date("d-m-y", $news['published'])); $template->setParams('authorLook', $author['look']); unset($result); unset($news1); unset($news); } [/code] This would allow you to use {authorLook} to show their look in your current code. Instead of using $onlineRow['look'].[/spoiler] [I]Just something to point out is that when you're creating a link to their home page you're using {username} when you should be using {newsAuthor}.[/I] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
PHP News Help
Top