collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 404
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Installation errors? Mod incompatibilities? Upgrade problems? Make your way over to the Install and Upgrade Support board for all your solutions!

Author Topic: A HTML/PHP SP Block which looks similar to a post  (Read 4855 times)

0 Members and 1 Guest are viewing this topic.

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
A HTML/PHP SP Block which looks similar to a post
« on: February 14, 2011, 12:55:43 AM »
Hello,

Can anyone help me in creating a HTML/PHP block which looks similar to a post.

The purpose of the block is to mimick a post in which I want to add google adsense and to put the block on the top of all posts. The theory says it increases adsense click through rate.

Many of the Vbulletin forums have the option to do so. I have seen one SMF having that implemented and I learned that they used a SP block above all posts which had HTML made to mimick a post.

Any help will be greatly appreciated.

pnreddy


Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A HTML/PHP SP Block which looks similar to a post
« Reply #1 on: February 15, 2011, 11:20:32 AM »
Easy solution:
1) Create a post that contains the ad-sense HTML
2) Create a custom php block
3) In that block, call ssi_fetchPosts (using the post's message id), and let it show the post.
 
Slightly more involved solution:
1) Create a custom block
2) Copy some HTML from a page that displays some post, and paste it into your block
3) Embed your AD-sense HTML in the middle of that post, instead of the post contents.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Re: A HTML/PHP SP Block which looks similar to a post
« Reply #2 on: February 16, 2011, 01:06:32 PM »
Quote
Slightly more involved solution:
1) Create a custom block
2) Copy some HTML from a page that displays some post, and paste it into your block
3) Embed your AD-sense HTML in the middle of that post, instead of the post contents.

I tried to do this much earlier before asking help here. I copied html and posted in Custom block(html), however, the block looks like a tower, but not as a post and skews entire page..I am unsure if I did correctly..

Quote
Easy solution:
1) Create a post that contains the ad-sense HTML
2) Create a custom php block
3) In that block, call ssi_fetchPosts (using the post's message id), and let it show the post

I think I will try this one.. But, can you please help me what code I should exactly add?

I am sorry if this sounds very silly, But I am a php noob!

Thanks,
pnr

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A HTML/PHP SP Block which looks similar to a post
« Reply #3 on: February 16, 2011, 02:42:46 PM »
I will help. First, see in ssi.php that function. see what information it wants.
 
Now, find a message you want to use. Find its message ID.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Re: A HTML/PHP SP Block which looks similar to a post
« Reply #4 on: February 17, 2011, 11:00:11 AM »
Its all geek to me :dead:

Can you help me with the html way?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A HTML/PHP SP Block which looks similar to a post
« Reply #5 on: February 17, 2011, 11:03:41 AM »
Over here in customization, it is all geek, all the time.
So get your geek on and get started :)
 
Find this posts's message ID.
Look at a post. see how the post's title is actually a link.
Hover over the link, and see how the URL of the link shows up in the status bar at the bottom of your browser. See the part of the URL that says msg and has a number? that's telling you the message ID.
 
Tell me the message ID of this message. Then you'll know you've figured it out.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Re: A HTML/PHP SP Block which looks similar to a post
« Reply #6 on: February 17, 2011, 11:09:50 AM »
Thanks, I would like to use the msg id 923 for using in the block

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A HTML/PHP SP Block which looks similar to a post
« Reply #7 on: February 17, 2011, 11:15:29 AM »
OK. I think you get that, but I cannot check. The id of my previous message (the one asking for the id) is 43166. If you get that, then you get it all.
 
Now, look in SSI.php for the function you'll want to call. I gave you the name of that function above.
Copy the proper line out of SSI.php and paste it into your next post. put  tags around it to make it look like code.
See how it lists the parameters you want?
Now, use that information to show how you think you might actually write a line of php code to call that function. It is OK to "cheat" and look at some actual php to see how other code writers have actually called other functions.
 
Go ahead.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline pnreddy

  • Semi Newbie
  • *
  • Posts: 43
    • www.pharmacovigilanceforum.com
  • SMF Version: 2 RC1-1
  • SP Version: 2.2.1
Re: A HTML/PHP SP Block which looks similar to a post
« Reply #8 on: February 17, 2011, 11:39:57 AM »
The below code is what I see in SSI.PHP
Quote
// Fetch a post with a particular ID. By default will only show if you have permission to the see the board in question - this can be overriden.
function ssi_fetchPosts($post_ids, $override_permissions = false, $output_method = 'echo')
{
   global $user_info, $modSettings;

   // Allow the user to request more than one - why not?
   $post_ids = is_array($post_ids) ? $post_ids : array($post_ids);

   // Restrict the posts required...
   $query_where = '
      m.id_msg IN ({array_int:message_list})' . ($override_permissions ? '' : '
         AND {query_wanna_see_board}') . ($modSettings['postmod_active'] ? '
         AND m.approved = {int:is_approved}' : '');
   $query_where_params = array(
      'message_list' => $post_ids,
      'is_approved' => 1,
   );

   // Then make the query and dump the data.
   return ssi_queryPosts($query_where, $query_where_params, '', 'm.id_msg DESC', $output_method);
}

Now, what should I modify in the code?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: A HTML/PHP SP Block which looks similar to a post
« Reply #9 on: February 17, 2011, 12:23:06 PM »
All you need is to see the function definition.
You will not need to modify any of this code
Code: [Select]
function ssi_fetchPosts($post_ids, $override_permissions = false, $output_method = 'echo')
Can you see there, where you have to give it a $post_id? That's the id of your one message.
Code: [Select]
ssi_fetchPosts(923);
Put that in your php block. It won't look EXACTLY the same as it looks on the forum, but it will be pretty close.
There's your introduction to php.
It's not that hard, really. http://w3schools.com/php
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?