The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Custom Header Extension :: Not showing for guests
I've hit a stumbling block when it comes to using a custom API Extension for vB5, I'm hoping someone else may have experienced this and have a solution.
I've developed an API Extension which pulls in an external header to make our forum more inline with our main site. This is all working perfectly for my admin account, however if I log out the header is no longer visible. I've check the user permissions in the Usergroup Manager tab and nothing stands out as being a problem. Any advice would be greatly appreciated. |
#2
|
||||
|
||||
Perhaps post your code so we can see what you did. It's really impossible to tell what the problem is without know exactly what you did.
|
#3
|
|||
|
|||
That would be helpful wouldn't it!
So in the template file I have: Code:
{vb:data returnHead, options, mcheadfunction} {vb:raw returnHead} Code:
<?php class Mcheadd_Api_Options extends vB_Api_Extensions { public $product = 'mcheadd'; public $developer = 'Developer'; public $title = 'Pull in Domain Name header'; public $minver = '5.1.0'; // public $maxver = '5.9.99';// Use vB default. // public $infourl = 'Domain Name'; // public $checkurl = 'Domain Name'; public $AutoInstall = 0; public $extensionOrder = 10; public function mcheadfunction(){ // create curl resource $ch = curl_init(); // set url curl_setopt($ch, CURLOPT_URL, "DomainName"); //return the transfer as a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // $output contains the output string $output = curl_exec($ch); $page_parts = explode('<!-- Top navigtation -->', $output); $page_parts = explode('<!-- DAB container -->', $page_parts[1]); $header_html = '<div id="header-mc">' . $page_parts[0] ; $header_html = str_replace("'", '"', $header_html); $output = str_replace(array("\r\n", "\r"), "\n", $header_html); $lines = explode("\n", $output); $new_lines = array(); foreach ($lines as $i => $line) { if(!empty($line)) $new_lines[] = trim($line); } $pageStuff = implode($new_lines); echo '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>'; echo "<script> $(document).ready(function(){ $('#outer-wrapper').prepend('" . $pageStuff . "'); $('.hamburger').click(function(){ $('#nav_top ul').toggleClass('mobile_show'); });}); </script>"; curl_close($ch); } } |
#4
|
|||
|
|||
Sorry to bug, Lynne. Do you have any idea what could be happening with this?
|
#5
|
||||
|
||||
I really have not spent much time doing coding for vB5 which is why I didn't answer. I do wonder why do you have both these lines when the second one will replace the first one?
Code:
$page_parts = explode('<!-- Top navigtation -->', $output); $page_parts = explode('<!-- DAB container -->', $page_parts[1]); Other than that, there really isn't enough information for us to be able to 'install' it on our own test site and see what is going on. |
#6
|
|||
|
|||
Thanks for the reply.
I have both of those lines so that I'm only using the code in between those two comments to avoid unnecessary markup. I've tried even doing a simple return of a string, which also doesn't appear when the user isn't logged in but is there if logged in. PHP Code:
--------------- Added [DATE]1426877795[/DATE] at [TIME]1426877795[/TIME] --------------- Lynne! Changing the echo to return worked, not sure why but it did! Thanks for all your help, you're my hero. |
Благодарность от: | ||
Lynne |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|