TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 17, 2024, 03:56:54 AM

Login with username, password and session length
Members
  • Total Members: 3,886
  • Latest: Grendor
Stats
  • Total Posts: 195,189
  • Total Topics: 21,220
  • Online today: 59
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 47
  • Total: 47

How to display msg in iframe

Started by Cyberion, November 09, 2007, 04:39:43 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Cyberion

Hello there guys.

I'm trying to display a message on my forum in the artcle using the iframe tag. However my entire forum is displayed.

Is there a way to solve this?

Here is an example of what i'm talking about

<iframe width="100%" scrolling="yes" height="600" frameborder="0" marginheight="0" marginwidth="0" src="http://www.cyberionsystems.com/exoclan/index.php?topic=1264.msg21365#msg21365"></iframe>

All i need is to display message 21365 instead of all those blocks, images, etc... I need entire text of this message to be displayed. Nothing else. No author, no replies. How can I do this? Badly in need of help as I have no idea how to do this. I rarely ask for help, but here i'm stuck.

Dragooon

You cannot use iFrame here. You will be needing PHP to do this.
Something like,

global $db_prefix;
$query = db_query("SELECT ID_MSG, body
                             FROM {$db_prefix}messages
                             WHERE ID_MSG = 21365
                             LIMIT 1",__FILE__, __LINE__) or die(mysql_error());
$body = array();
while ($row = mysql_fetch_assoc($query)) {
        $body[] = array(
          'msg' => $row['body'],
        );
}
mysql_free_result($query);
foreach($body as $b)
{
echo $b;
}

This is a untested code I just wrote while replying to this post

Cyberion

hmmm thx for the help bro, but it doesn't work. I switched to PHP article, pasted your code in there

and here what it gives - http://www.cyberionsystems.com/exoclan/index.php?page=19


It jsut writes "array" that's it. Any ideas?

bloc

Try instead of "echo $b;" to use "echo $b['msg'];"

Cyberion

thx Bloc, it works, however it displays the text with all formating. So it kinda ignores any bbcode tags and displays the text and thos tags from the message.

Any ideas to this problem?

Sorry for being such a noob, but i'm really bad at php coding, i'm trying to figure out something, but this is over my skills ;)

You can see what I mean by following the link again - http://www.cyberionsystems.com/exoclan/index.php?page=19

bloc

ah, i forgot..of course you need to convert it too. Use

echo doUBBC($b['msg']);

and all bbc codes should display correctly.

Cyberion

thx Bloc, it now works perfectly.

Here is the final compilation for those that might be interested in such feature (the following code is created by Dragooon and fixed by Bloc):

For displaying a certain message from your forum in the PHP article, change the line "WHERE ID_MSG = 21365" to a number related to your message.
global $db_prefix;
$query = db_query("SELECT ID_MSG, body
                             FROM {$db_prefix}messages
                             WHERE ID_MSG = 21365
                             LIMIT 1",__FILE__, __LINE__) or die(mysql_error());
$body = array();
while ($row = mysql_fetch_assoc($query)) {
        $body[] = array(
          'msg' => $row['body'],
        );
}
mysql_free_result($query);
foreach($body as $b)
{
echo doUBBC($b['msg']);
}

Dragooon

Thanks Bloc :)
This is what happens when I write my code at 2 AM :P