Topic: php in main.tpl
can i use php in main.tpl?
and if so
how could i do: if your on index.php, show <div class=box>
but if your on any other page, dont show <div class=box>
any ideas?
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → php in main.tpl
can i use php in main.tpl?
and if so
how could i do: if your on index.php, show <div class=box>
but if your on any other page, dont show <div class=box>
any ideas?
Not directly
http://punbb.org/docs/faq.html#faq3_4
Yes, see: http://punbb.org/docs/faq.html#faq3_4 (edit: darnit Smartys )
To discern whether or not a user is on the index, use something like
if(basename($_SERVER['PHP_SELF'], 'php') == 'index')
{
...
}
hmm my "sidebar" aint showing up
heres my main.tpl
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html dir="<pun_content_direction>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />
<pun_head>
<style type="text/css">
#left {
width: 140px;
float: left;
}
#main {
margin-left: 150px;
}
#container {
width: 100%;
float: right;
margin-left: -140px;
}
</style>
</head>
<body>
<div id="punwrap">
<div id="pun<pun_page>" class="pun">
<div id="brdheader" class="block">
<div class="box">
<div id="brdtitle" class="inbox">
<pun_title>
<pun_desc>
</div>
<pun_navlinks>
<pun_status>
</div>
</div>
<div id="container">
<div id="main">
<pun_announcement>
<pun_main>
</div>
</div>
<pun_include "sidebar.php">
<div class="clearer"></div>
<pun_footer>
</div>
</div>
</body>
</html>
and heres my sidebar.php in /include/user
<?php
if(basename($_SERVER['PHP_SELF'], 'php') == 'index')
{
?>
<div id="left">
<div class="block">
<h2><span>Menu</span></h2>
<div class="box">
<pun_sidelinks>
</div>
</div>
<div class="block">
<h2><span>Whos Online?</span></h2>
<div class="box">
<pun_online>
</div>
</div>
</div>
<?php
}
else {
}
?>
my punbb is modified like how connorhd miniportal which i have an index.php which i want the sidebar to show and a forum.php which i just want the forum without a sidebar
Oops, I left out a period. I should have written
if(basename($_SERVER['PHP_SELF'], '.php') == 'index')
{
...
}
By the way, the empty else {} is unnecessary and I'm not sure if template tags (like <pun_sidelinks> and <pun_online>) will work within a PHP.
<pun_online> and <pun_sidelinks> work within a php file
now i just need to get my css to work
thx pogenwurst
one more question
can you include an external stylesheet in a tpl file?
or would it be better to put it in the header.php file
<pun_online> and <pun_sidelinks> work within a php file
Cool, I'm glad it worked then.
can you include an external stylesheet in a tpl file?
or would it be better to put it in the header.php file
It doesn't really matter either way; adding it into the template would be easier however.
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → php in main.tpl
Powered by PunBB, supported by Informer Technologies, Inc.