phpBBHacks.com - BBCode for postid
Community management insight at ManagingCommunities.com
StatsForums Home   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in
FAQFAQ   SearchSearch   MemberlistMemberlist   TutorialsTutorials   ContactContact Us
Username:    Password:
Remember Me?    
   I Lost My Password!
Bookmark and Share
Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2 Hack Requests and Development
 See a User Guidelines violation? Please contact us.
Author Message

roppie
New User

Joined: 28 Feb 2006
Posts: 6
Location: Netherlands

PostPosted: August 17th 2010, 12:59 pm    Post subject: BBCode for postid Reply with quote

Hello,

I've set up an mobile version of my website in which i'm using different .php-files for mobile and desktop (e.g. mobviewtopic.php for mobile). In some of my topics are links to other topics. Now I'm looking for a bbcode which gives me the possibility to just put the postid number, so it refers to the mobile pages on the mobile version en to the desktoppages on the desktopversion.

Something like: [post=5736]example text[/post]

I'm looking for it already a couple of days, but still haven't found it. I hope you can help me with it.

Thanks in advance.
Back to top
View user's profile Send private message Visit poster's website

Patrick
Admin/Webmaster

Joined: 11 May 2001
Posts: 17279
Location: Harbinger, NC, U.S.A.

PostPosted: August 22nd 2010, 11:42 am    Post subject: Reply with quote

Does anyone have any thoughts on this?

Thanks,

Patrick
_________________
Patrick O'Keefe - phpBBHacks.com Administrator - Feedback? Questions? Please Contact Me!
User Guidelines - Featured phpBB - Featured Author - phpBBHacks.com Awards - Supported Sites - About Us
Author, Managing Online Forums - A Practical Guide to Community Management
phpBB 3 Tutorials: Add Hacks | Clear Your Cache | Fix Missing Images | phpBB 3 Permissions Guide
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger

roppie
New User

Joined: 28 Feb 2006
Posts: 6
Location: Netherlands

PostPosted: August 22nd 2010, 1:28 pm    Post subject: Reply with quote

This is what i set up my own, but it doesn't work.

includes/bbcode.php

Code:
   $bbcode_tpl['post'] = str_replace('{URL}', '\\1', $bbcode_tpl['post']);
   $bbcode_tpl['post'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['post1']);


Code:
        // [post=postid]Post ID[/post] code..
        $patterns[] = "#\[post=(0-9)\](.*?)\[/post\]#is";
        $replacements[] = $bbcode_tpl['post1'];


templates/.../bbcode.tpl

Code:
<!-- BEGIN post --><a href="http://www.---.nl/phpbb/viewtopic.php?p={URL}#{URL}" class="postlink">{DESCRIPTION}</a><!-- END post -->


I don't need the code in the faq, or posting.tpl. I just want it to work in posts.
Back to top
View user's profile Send private message Visit poster's website

roppie
New User

Joined: 28 Feb 2006
Posts: 6
Location: Netherlands

PostPosted: August 31st 2010, 7:20 am    Post subject: Reply with quote

I finally fixed it myself. This is the right code, in case someone else likes this mod.

includes/bbcode.php

Code:
   $bbcode_tpl['post1'] = str_replace('{URL}', 'viewtopic.php?p=\\1#\\1', $bbcode_tpl['post']);
   $bbcode_tpl['post1'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['post1']);


Code:
        // [post=postid]Post ID[/post] code..
        $patterns[] = "#\[post=([0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[0-9])\](.*?)\[/post\]#is";
        $replacements[] = $bbcode_tpl['post1'];


templates/.../bbcode.tpl

Code:
<!-- BEGIN post --><a href="{URL}" class="postlink">{DESCRIPTION}</a><!-- END post -->
Back to top
View user's profile Send private message Visit poster's website

Patrick
Admin/Webmaster

Joined: 11 May 2001
Posts: 17279
Location: Harbinger, NC, U.S.A.

PostPosted: August 31st 2010, 1:54 pm    Post subject: Reply with quote

Thank you for sharing it, roppie. Glad that you found a solution.

Patrick
_________________
Patrick O'Keefe - phpBBHacks.com Administrator - Feedback? Questions? Please Contact Me!
User Guidelines - Featured phpBB - Featured Author - phpBBHacks.com Awards - Supported Sites - About Us
Author, Managing Online Forums - A Practical Guide to Community Management
phpBB 3 Tutorials: Add Hacks | Clear Your Cache | Fix Missing Images | phpBB 3 Permissions Guide
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger

roppie
New User

Joined: 28 Feb 2006
Posts: 6
Location: Netherlands

PostPosted: September 13th 2010, 1:39 am    Post subject: Reply with quote

One little update on the code:

Code:
   $bbcode_tpl['post1'] = str_replace('{URL}', 'viewtopic.php?p=\\1#\\1', $bbcode_tpl['post']);
   $bbcode_tpl['post1'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['post1']);


replace by

Code:
   $bbcode_tpl['post1'] = str_replace('{URL}', '#\\1', $bbcode_tpl['post']);
   $bbcode_tpl['post1'] = str_replace('{DESCRIPTION}', '\\2', $bbcode_tpl['post1']);


This makes it faster, because it uses #postid instead of the full link, but it works only if the post is on the same page as the link.

Besides if someone uses this update, you might need an [topic]-code as well, to link to other topics, because topic-id's work with "t=" instead of "p=".
Back to top
View user's profile Send private message Visit poster's website

Patrick
Admin/Webmaster

Joined: 11 May 2001
Posts: 17279
Location: Harbinger, NC, U.S.A.

PostPosted: September 16th 2010, 12:28 pm    Post subject: Reply with quote

Thanks for sharing that, roppie.

Patrick
_________________
Patrick O'Keefe - phpBBHacks.com Administrator - Feedback? Questions? Please Contact Me!
User Guidelines - Featured phpBB - Featured Author - phpBBHacks.com Awards - Supported Sites - About Us
Author, Managing Online Forums - A Practical Guide to Community Management
phpBB 3 Tutorials: Add Hacks | Clear Your Cache | Fix Missing Images | phpBB 3 Permissions Guide
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2 Hack Requests and Development All times are GMT - 6 Hours
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Big Message Boards - Free JavaScript - phpBB2 - phpbb styles - Suporte phpBB - phpBB Česky - phpBB Turkiye - phpBBArabia.com - phpBB-fr.com - Romanian phpBB online community - phpBB-TW.net - phpBBservice.nl - phpBB Brasil - phpBB Portugal - phpBBpersian.com

Network: iFroggy Hosting - PhotoshopForums.com - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - KarateForums.com - Bad Boy Blog - SodaRatings.com - Patrick O'Keefe

< Advertising - Contact Us - Disclosure Policy - Staff - User Guidelines >

Copyright © 2001-2012. iFroggy Network, phpBBHacks.com. All Rights Reserved. Privacy Policy. We Support phpBBHacks.com (of course!).
Powered by phpBB © phpBB Group. phpBB SEO. We are in no way affiliated with the phpBB Group. phpBB is copyright to the phpBB Group.