MyBB Community Forums

Full Version: [Page Manager] Share your custom pages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
This post http://community.mybb.com/thread-63357-p...#pid474410

The ban list is an excellent example as it uses php and viewing permissions.Download it and install and study the code - it is clean and easy to follow.
(2012-07-19, 10:05 AM)Leefish Wrote: [ -> ]This post http://community.mybb.com/thread-63357-p...#pid474410

The ban list is an excellent example as it uses php and viewing permissions.Download it and install and study the code - it is clean and easy to follow.

I am really not good with PHP code and stuff. Wink I hope you are referring to that part here of the code on top.

Quote:global $headerinclude, $header, $theme, $footer;
if ($mybb->user['uid'] == 0)
{
error_no_permission();
}

Is that all I would need for something like this to work so that guests cannot see that page ?

I appreciate the help.

Wolfseye
Yes, that is EXACTLY what you need. Of course, the whole page has to be php then. What were you trying to make?
(2012-07-19, 10:14 AM)Leefish Wrote: [ -> ]Yes, that is EXACTLY what you need. Of course, the whole page has to be php then. What were you trying to make?

I need something simple. The whole page is supposed to be an Iframe, to included something from a different website. Could you tell me please which code (PHP) i would need to use and where to put the Iframe then in the middle ?

Or for example a very simple page with just simple html code. I would like to use that with that usergroup check function as in the ban page.

As I said, i am no good with PHP as for these things. I would appreciate any help. Huh

Thank you.

Wolfseye
Try this

<?php

global $headerinclude, $header, $theme, $footer, $lang;

if($mybb->user['uid']==0) error_no_permission();


$template = '<html>
<head>
<title>'.$pages['name'].'</title>
{$headerinclude}

</head>


<body>
{$header}
<table border="0" cellspacing="'.$theme['borderwidth'].'" cellpadding="'.$theme['tablespace'].'" class="tborder">
<tr><td class="thead" colspan="2">
<strong>'.$pages['name'].'</strong>
</td></tr>
<tr>
<td class="trow1"><iframe src="LINK TO THE PAGE" width="100%" height=800></iframe></td>
</tr>

</table>
<br />
{$footer}
</body>
</html>';

$template = str_replace("\'", "'", addslashes($template));

add_breadcrumb($pages['name']);

eval("\$page = \"".$template."\";");

output_page($page);

?>

Where it says link to the page you obviously have to link to your page. Set Use MyBB Template? to NO
Thanks. Wink Appreciate your help.

Seems to work fine. But in my example, i would need the iframe technically around 800px wide and the height depends a bit, so 100% would be the best and without specifying a height.

But when I do that, use 800px for width, and 100% for height, it gives me the right width but only a very small height. Is that normal ?

Or is there any way I can do something to make the Iframe in automatic height, someting i can specify in the page ?
I am not an expert on iFrames (I really dislike them to be honest) but as far as I know, height cannot be defined as a percent. Hmm. Found this>

http://www.daveoncode.com/2009/06/12/ada...avascript/
(2012-07-19, 11:00 AM)Leefish Wrote: [ -> ]I am not an expert on iFrames (I really dislike them to be honest) but as far as I know, height cannot be defined as a percent. Hmm. Found this>

http://www.daveoncode.com/2009/06/12/ada...avascript/

I was also doing some googling and I also found that it won't work with automatic height and iframes. What you linked there sounds interesting.

Question is, how would that work in the form of my page ? How would the code need to be to make that work ?

I hope there is some expert in this here, bothering to help me out with this. Wink

Thanks Leefish, I appreciate your help ! Wink

Wolfseye
well, I had a quick go, but I suck at javascript. Handing over to a smarter coder now....
Thanks anyways. Wink
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49