subzero Posted June 14, 2007 Share Posted June 14, 2007 I am very newbie at php but anyways, here is the problem. This is the html which uses [+mybb.url+] placeholder, <li><a href="[+mybb.url+]/online.php">View Details</a></li> It is showing my links as, examplesite.com/online.php when I need it to show it as examplesite.com/forum/online.php (I've replaced the actual website with "examplesite.com" and the username with "username") Here is the php code <?php # MyBB Bolt-On # by Peter Burlingham # Version 0.5 - December 2006 # Full usage instructions: http://www.acronymity.co.uk/projects/mybb_bolt_on/instructions.html ### Settings ### // Path to MyBB (with trailing slash) $mybb_path = "/home/.joshia/username/examplesite.com/forum/"; // Path to snippets folder $snippet_path = $modx->config['base_path'] . "assets/snippets/mybb/"; // Required globals to make this work global $mybb, $db, $cache, $plugins, $displaygroupfields, $grouppermignore, $groupzerogreater, $lang, $fpermfields; // Get our usable functions require_once($snippet_path.'mybb_functions.php'); // Un-comment to get a lot of MyBB vars. //echo "<pre>"; //print_r($mybb); //echo "</pre>"; //exit; // So what are we doing? switch ($get_me_my) { ### Display user info based on forum group settings ### case 'userinfo': // Default groups: Guest = 1, Member = 2, Super Moderator = 3, Admin = 4, Validating = 5, Moderator = 6, Banned = 7 // Pass the board URL $modx->setPlaceholder('mybb.url', $mybb->settings['bburl']); if (($mybb->user['usergroup'] == 1) || ($mybb->user['usergroup'] == 5) || ($mybb->user['usergroup'] == 7)) { // For guests... $modx->setPlaceholder('mybb.showuserinfo', '{{MyBB_UserLoggedOut}}'); } else { // For everyone else... // Get new topic and post info $newinfo = latestposts($db,$mybb); $modx->setPlaceholder('mybb.uid', $mybb->user['uid']); $modx->setPlaceholder('mybb.username', $mybb->user['username']); $modx->setPlaceholder('mybb.newmsg', (integer)$mybb->user['pms_new']); $modx->setPlaceholder('mybb.newtopic', $newinfo['newthreads']); $modx->setPlaceholder('mybb.newpost', $newinfo['newposts']); $modx->setPlaceholder('mybb.showuserinfo', '{{MyBB_UserLoggedIn}}'); } break; ### Show forum statistics ### case 'stats': // Grab the stats from the forum cache $stats = $cache->read("stats"); // Parse the stats template $modx->setPlaceholder('mybb.nummembers', $stats['numusers']); $modx->setPlaceholder('mybb.numthreads', $stats['numthreads']); $modx->setPlaceholder('mybb.numposts', $stats['numposts']); $modx->setPlaceholder('mybb.newmember', $stats['lastusername']); $modx->setPlaceholder('mybb.newuid', $stats['lastuid']); break; ### Show online users ### case 'online': $online = onlinelist($db,$mybb,$cache); // What shall we separate the list of users with? A comma, a middot, or anything else of your choice. $separator = ' · '; // When displaying online users, shall we apply colouring styles to their name as in the forums for different groups? $forumstyle = 1; $modx->setPlaceholder('mybb.numonline', $online['count']); $modx->setPlaceholder('mybb.numguests', $online['guests']); $modx->setPlaceholder('mybb.nummembers', $online['members']); // Go through online users if there are any and put together a list if ($online['members'] >= 1) { $onlinelist = ''; $i = 1; foreach ($online['users'] as $user) { if ($forumstyle == 1) { $onlinelist .= '<a href="'.$mybb->settings['url'].'/member.php?action=profile&uid='.$user['uid'].'">'.$user['forumnamestyle'].'</a>'; } else { $onlinelist .= '<a href="'.$mybb->settings['url'].'/member.php?action=profile&uid='.$user['uid'].'">'.$user['name'].'</a>'; } if ($i < $online['count']) { $onlinelist .= $separator; } $i++; } $modx->setPlaceholder('mybb.showlist', $onlinelist); $modx->setPlaceholder('mybb.onlinelist', '{{MyBB_OnlineList}}'); } break; ### Show forum topics (news headlines) ### // Sample call - // Change the forum topics are grabbed from by changing the fid to your news forum's ID. // To get topics from more than one forum, separate your fid's wtith a comma eg. &fid=2,3,6,11 // Change number of topics returned by changing the limit to whatever you desire. A really high limit will return more topics and slow your page down though! case 'headlines': $modx->setPlaceholder('mybb.url', $mybb->settings['/bburl']); $fid = (isset($fid))? $fid : 2; $limit = (isset($limit))? $limit : 10; $headlines = headlines($db,$mybb,$cache,$templates,$parser,$fid,$limit); $articlelist = ""; $i = 1; if (!empty($headlines)) { foreach ($headlines as $headline) { $modx->setPlaceholder('mybb.arttitle', $headline['subject']); $modx->setPlaceholder('mybb.artdate', $headline['dateline']); $modx->setPlaceholder('mybb.artcontent', $headline['message']); $modx->setPlaceholder('mybb.artauthor', $headline['username']); $modx->setPlaceholder('mybb.artid', $headline['tid']); $modx->setPlaceholder('mybb.artcomments', $headline['replies']); // Very fancy and un-documented MODx function - lucky I found it or I'd have template bits in my snippet (eww!) $articlelist .= $modx->mergePlaceholderContent($modx->mergeChunkContent("{{MyBB_NewsArticle}}")); // Add a divider chunk below every article except the last one. Counting the headlines array instead of using our $limit variable in case there's less than $limit articles returned in the query y'see? if ($i < count($headlines)) { $articlelist .= "{{MyBB_NewsDivider}}"; } $i++; } } else { $articlelist = "There were no news topics found in the forum you specified."; } $modx->setPlaceholder('mybb.newsarticles', $articlelist); break; ### Show latest posts ### // Sample call - // Change limit to the number of latest posts you want to display. // Change the trim to how many characters you want the title to be trimmed to. Set to zero to skip trimming. // Change the format the date and time are displayed in as per www.php.net/date case 'latest_posts': $modx->setPlaceholder('mybb.url', $mybb->settings['/bburl']); $limit = (isset($limit))? $limit : 5; $trim = (isset($trim))? $trim : 25; $dateformat = "jS M 'y"; $timeformat = "g:ia"; $lastxposts = lastxposts($db,$mybb,$limit,$trim,$dateformat,$timeformat); $postlist = ""; $i = 1; if (!empty($lastxposts)) { foreach ($lastxposts as $post) { $modx->setPlaceholder('mybb.postid', $post['tid']); $modx->setPlaceholder('mybb.posttitle', $post['subject']); $modx->setPlaceholder('mybb.postdate', $post['lastpostdate']); $modx->setPlaceholder('mybb.posttime', $post['lastposttime']); //if ($post['lastposteruid'] $modx->setPlaceholder('mybb.postauthor', $post['lastposter']); // Very fancy and un-documented MODx function - lucky I found it or I'd have template bits in my snippet (eww!) $postlist .= $modx->mergePlaceholderContent($modx->mergeChunkContent("{{MyBB_LatestPost}}")); $i++; } } else { $postlist = "There are no topics to display."; } $modx->setPlaceholder('mybb.lastxposts', $postlist); break; ### Show upcoming events ### // Sample call - // Change limit to the number of events you want to display. // Change the trim to how many characters you want the title to be trimmed to. Set to zero to skip trimming. // Change the format the date and time are displayed in as per www.php.net/date case 'upcoming_events': $modx->setPlaceholder('mybb.url', $mybb->settings['/bburl']); $limit = (isset($limit))? $limit : 5; $trim = (isset($trim))? $trim : 25; $dateformat = "jS M 'y"; $nextxevents = nextxevents($db,$mybb,$limit,$trim,$dateformat); $eventlist = ""; $i = 1; if (!empty($nextxevents)) { foreach ($nextxevents as $event) { $modx->setPlaceholder('mybb.eventid', $event['eid']); if (isset($event['short_subject'])) { $modx->setPlaceholder('mybb.eventtitle', $event['short_subject']); } else { $modx->setPlaceholder('mybb.eventtitle', $event['subject']); } $modx->setPlaceholder('mybb.eventalt', $event['subject']); $modx->setPlaceholder('mybb.eventdate', $event['format_date']); // Very fancy and un-documented MODx function - lucky I found it or I'd have template bits in my snippet (eww!) $eventlist .= $modx->mergePlaceholderContent($modx->mergeChunkContent("{{MyBB_UpcomingEvent}}")); $i++; } } else { $eventlist = "There are no events to display."; } $modx->setPlaceholder('mybb.nextxevents', $eventlist); break; ### Pass me my slippers and pipe ### case 'slippers_n_pipe': echo "Mmmf... that's better. Now fetch me a cup of Earl Grey."; break; } return ''; ?> Any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/55655-quick-question-about-a-placeholder/ Share on other sites More sharing options...
DJTim666 Posted June 15, 2007 Share Posted June 15, 2007 <li><a href="[+mybb.url+]/forum/online.php">View Details</a></li> Quote Link to comment https://forums.phpfreaks.com/topic/55655-quick-question-about-a-placeholder/#findComment-275021 Share on other sites More sharing options...
subzero Posted June 15, 2007 Author Share Posted June 15, 2007 I know I could do that lol, but for somethings I cant. [!MyBB? &get_me_my=`online`!] <h2>Users Online</h2> <ul> <li>[+mybb.numonline+] users online</li> <li>[+mybb.numguests+] guests</li> <li>[+mybb.nummembers+] members</li> [+mybb.onlinelist+]<br /> <li><a href="[+mybb.url+]/online.php">View Details</a></li> </ul> This placeholder wouldn't work with that option, [+mybb.onlinelist+] for it displays users and links them. Quote Link to comment https://forums.phpfreaks.com/topic/55655-quick-question-about-a-placeholder/#findComment-275027 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.