MyBB Community Forums

Full Version: Custom PHP page modification questions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using Page Manager as a testing point for future to make my own custom standalone PHP page.

I have the Square theme and working on a semless page as a test.

In Chrome developer console I managed to turn it seamless by modifying properties of the .wrapper and changing the clear both tag in the 'Div ID content' to remove a <br>

Question is on my own php page how would I override these styles for that page only?

My test isn't perfect as I used the Chrome developer console to see what was affecting the margin so still playing around with whats needed to get it right, but it shows what I am trying to achieve.

Original

[Image: TnbeTgq.jpg]

With the changes in developer console.

[Image: NQSgxmz.jpg]
as you said, if MyBB template is selected for the page then it will take predefined style properties.
to override the predefined styles, you may have to add custom CSS stylesheet specific to the page

related guidance - Add Stylesheet (MyBB 1.6.x)
Cheers for that .m. I'll look it up.

I'm playing around with my own template and a php page and working much better to what I want and I can do inline styles in the template to override and achieve this but I will look at your link and would go with a custom css just for this template.

Also I have duplicated the header to my template and can remove what I need etc to make a diffrent header for that page.

Opens up many possibilities.

All this is just testing getting my head around a couple things on decisions before doing a proper test.

Been a long while since I've done any forum stuff.

Cheers Mate

Update: some editing on my template etc and It's all good to what I was thinking.
Now to work on getting widgets there in the template etc.


Something I massively overlooked.

Anyway to force the template to use a specific theme?

So if the forum theme changes the template and php stays as one theme?
^ reg. templates, theme properties has a option to select the templates set

forum admin panel >> Templates & Style >> Themes >> [theme] >> edit theme properties >> Template Set

related guidance : Themes (MyBB 1.6.x) | Templates (MyBB 1.8.x)
(2017-09-04, 03:26 PM).m. Wrote: [ -> ]^ reg. templates, theme properties has a option to select the templates set

forum admin panel >>  Templates & Style >> Themes >> [theme] >> edit theme properties >> Template Set

related guidance : Themes (MyBB 1.6.x) | Templates (MyBB 1.8.x)

Not exactly what I'm after.

I have tried many things and cant seem to work it out.

The closest I got was a custom php page using copied headers and footers from a theme.

But if a user would have a separate forum theme that becomes moot.
What I want is to set a separate theme for a php page I created.

I tried a template but that didn't work too well either.

Calling a template from a php file:
Theme used for this is Square

<?php
define("IN_MYBB",1);
include("global.php");
eval("\$page .= \"".$templates->get("test")."\";");
output_page($page);  
?>

The template I called:
<html>
<head>
<title>site test</title>
{$headerinclude}
<style>
#container {
background: #003965;
}
.breadcrumb {
display: none;
}
.indexpage
{
color: #FFFFFF;
}
</style>

</head>
<body>
<div class="scrolltotop"><i class="fa fa-caret-up fa-2x"></i></div>

<div id="container">

	<div id="header">
		<div class="wrapper">
          	<div class="logo"><div class="logo2"><i class="fa fa-cube fa-fw"></i></div> Square</div>
          	<div class="menu">
              	<ul>
                  	<li><a href="{$mybb->settings['bburl']}/index.php"><i class="fa fa-comments fa-2x"></i><br />Index</a></li>
                  	<li><a href="{$mybb->settings['bburl']}/search.php"><i class="fa fa-search fa-2x"></i><br />Search</a></li>
                  	<li><a href="{$mybb->settings['bburl']}/memberlist.php"><i class="fa fa-users fa-2x"></i><br />Members</a></li>
                  	<li><a href="{$mybb->settings['bburl']}/calendar.php"><i class="fa fa-calendar-o fa-2x"></i><br />Calendar</a></li>
                	<li><a href="{$mybb->settings['bburl']}/misc.php?action=help"><i class="fa fa-question-circle fa-2x"></i><br />Help</a></li>
              	</ul>
          	</div>
		</div>
	</div>
  

      
		<div id="content">
			<div class="wrapper">
	
          	<div class="indexpage">
				<br />
					Front page content goes here
				</div>	
	
</div>
</div>

<style="clear: both;" />

<div id="footer">
	<div class="wrapper">
      	<div class="one">
          	<h3>About us</h3>
          	<p>Fill me with text pleaaaaaaaaaaaaaaase.</p>
          	<p>Fill me with text pleaaaaaaaaaaaaaaase.</p>
          	<p>Fill me with text pleaaaaaaaaaaaaaaase.</p>
          	<p>Fill me with text pleaaaaaaaaaaaaaaase.</p>
            <p>Fill me with text pleaaaaaaaaaaaaaaase.</p>
      	</div>
      	<div class="two">
          	<h3>Navigation</h3>
          	<ul>
                <li><a href="{$mybb->settings['bburl']}/index.php"><i style="font-size: 14px;" class="fa fa-comments fa-fw"></i> Index</a></li>
                <li><a href="{$mybb->settings['bburl']}/search.php"><i style="font-size: 14px;" class="fa fa-search fa-fw"></i> Search</a></li>
                <li><a href="{$mybb->settings['bburl']}/memberlist.php"><i style="font-size: 14px;" class="fa fa-users fa-fw"></i> Members</a></li>
                <li><a href="{$mybb->settings['bburl']}/calendar.php"><i style="font-size: 14px;" class="fa fa-calendar-o fa-fw"></i> Calendar</a></li>
				<li><a href="{$mybb->settings['bburl']}/misc.php?action=help"><i style="font-size: 14px;" class="fa fa-question-circle fa-fw"></i> Help</a></li>
			</ul>
      	</div>
      	<div class="three">
          	<h3>Quick links</h3>
          	<ul>
              	{$contact_us}
				<li><a href="{$mybb->settings['bburl']}/misc.php?action=syndication"><i style="font-size: 14px;" class="fa fa-rss fa-fw"></i> {$lang->bottomlinks_syndication}</a></li>
              	<li><a href="{$mybb->settings['bburl']}/search.php?action=getnew"><i style="font-size: 14px;" class="fa fa-comments fa-fw"></i> {$lang->welcome_newposts}</a></li>
				<li><a href="{$mybb->settings['bburl']}/search.php?action=getdaily"><i style="font-size: 14px;" class="fa fa-comments-o fa-fw"></i> {$lang->welcome_todaysposts}</a></li>
              	<li><a href="<archive_url>"><i style="font-size: 14px;" class="fa fa-file-o fa-fw"></i> {$lang->bottomlinks_litemode}</a></li>
			</ul>
      	</div>
    </div>
</div>

<div id="copyright">
  	<div class="wrapper">
      	<div style="float: left;">
          	<!-- MyBB is free software developed and maintained by a volunteer community.
					It would be much appreciated by the MyBB Group if you left the full copyright and "powered by" notice intact,
					to show your support for MyBB.  If you choose to remove or modify the copyright below,
					you may be refused support on the MyBB Community Forums.

					This is free software, support us and we'll support you. -->
				{$lang->powered_by} <a href="https://mybb.com" target="_blank">MyBB{$mybbversion}</a>, &copy; 2002-{$copy_year} <a href="https://mybb.com" target="_blank">MyBB Group</a>.
				<!-- End powered by -->
      	</div>
      	<div style="float: right;">
          	Square theme by <a href="http://community.mybb.com/user-75705.html" target="_blank">eNvy</a> &copy; 2015-2017.
      	</div>
  	</div>
<!-- The following piece of code allows MyBB to run scheduled tasks. DO NOT REMOVE -->{$task_image}<!-- End task image code -->
{$auto_dst_detection}
</div>
</body>
</html>

Also tried making a stand alone php file that that din't work too well.
Anytime the theme is changed, the template or php messes up as it tries to apply to the selected theme instead of just the 1 it was coded for.
Eg its coded for Square and if anyone uses default or something else it'll mess up.

If I only wanted to force 1 theme and that's it no changes allowed on the forum by users it would be fine.
Basically all I wanted is a separate front page using a certain MyBB theme so if a user would change the theme in the forums the front page stays on a certain theme.

I'm not really a coder so I guess it would have to be written all independent of MyBB as I was also hoping once I had a separate page with a theme I could put blocks on showing current threads etc in a custom div layout structure.