1
sabahan
Custom PHP Page with no header and footer
  • 2015/2/9 4:12

  • sabahan

  • Quite a regular

  • Posts: 317

  • Since: 2006/3/4 5


i have this custom php page fro xoops...How do i have page with no header and footer, just some simple white background

i dont want to apply the theme.html layout.. dont want the header, footer, etc

i just want to have a white background with my html/php content

i want to use multilingual tag in my custom page so i can't use a normal html file

is this possible ?


include("../../mainfile.php"); 
include(
XOOPS_ROOT_PATH."/header.php"); 

$meta_keywords ""
$meta_description ""
$pagetitle ""

if(isset(
$xoTheme) && is_object($xoTheme)) { 
    
$xoTheme->addMeta'meta''keywords'$meta_keywords); 
    
$xoTheme->addMeta'meta''description'$meta_description); 
} else {    
// Compatibility for old Xoops versions 
    
$xoopsTpl->assign('xoops_meta_keywords'$meta_keywords); 
    
$xoopsTpl->assign('xoops_meta_description'$meta_description); 


$xoopsTpl->assign('xoops_pagetitle'$pagetitle); 

//this will only work if your theme is using this smarty variables 
$xoopsTpl->assign'xoops_showlblock'0); //set to 0 to hide left blocks 
$xoopsTpl->assign'xoops_showrblock'0); //set to 0 to hide right blocks 
$xoopsTpl->assign'xoops_showcblock'1); //set to 0 to hide center blocks 
?> 

htmml or php content 

include(XOOPS_ROOT_PATH."/footer.php"); 
?>

2
Mamba
Re: Custom PHP Page with no header and footer
  • 2015/2/9 5:55

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Quote:
i dont want to apply the theme.html layout.. dont want the header, footer, etc

I think, the easiest way would be to just copy and rename the /default theme, and then modify the theme.html by removing what you don't want, but still taking advantage of the other elements included in the theme?

But this is just my guess, and maybe some of our theme gurus can provide you with a better advise?
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

3
bitcero
Re: Custom PHP Page with no header and footer
  • 2015/2/9 7:14

  • bitcero

  • Quite a regular

  • Posts: 318

  • Since: 2005/11/26


All is possible! :) The solution is in two steps: You code is good, but change the last line.

include("../../mainfile.php");  
include(
XOOPS_ROOT_PATH."/header.php");  

$meta_keywords "";  
$meta_description "";  
$pagetitle "";  

if(isset(
$xoTheme) && is_object($xoTheme)) {  
    
$xoTheme->addMeta'meta''keywords'$meta_keywords);  
    
$xoTheme->addMeta'meta''description'$meta_description);  
} else {    
// Compatibility for old Xoops versions  
    
$xoopsTpl->assign('xoops_meta_keywords'$meta_keywords);  
    
$xoopsTpl->assign('xoops_meta_description'$meta_description);  
}  

$xoopsTpl->assign('xoops_pagetitle'$pagetitle);  

//this will only work if your theme is using this smarty variables  
$xoopsTpl->assign'xoops_showlblock'0); //set to 0 to hide left blocks  
$xoopsTpl->assign'xoops_showrblock'0); //set to 0 to hide right blocks  
$xoopsTpl->assign'xoops_showcblock'1); //set to 0 to hide center blocks  
?>  

htmml or php content  

echo $xoopsTpl->fetch'your_template_path' );
?>
Then, create a template with all styles and content that you wish, but remember to provide all HTML structure:
DOCTYPE html>
<
html>
  <
head>...head>
  <
body>...body>
html>
Of course this solution is valid only with Smarty.

4
sabahan
Re: Custom PHP Page with no header and footer
  • 2015/2/9 8:29

  • sabahan

  • Quite a regular

  • Posts: 317

  • Since: 2006/3/4 5


Thanks mamba and bitcero

Bitcero method is working and it exactly what i want

xoops is amazing

just one issue .. i put my code in root and my code is like this

test.php

include("/mainfile.php");   
include(
XOOPS_ROOT_PATH."/header.php");   

$meta_keywords "";   
$meta_description "";   
$pagetitle "";   

if(isset(
$xoTheme) && is_object($xoTheme)) {   
    
$xoTheme->addMeta'meta''keywords'$meta_keywords);   
    
$xoTheme->addMeta'meta''description'$meta_description);   
} else {    
// Compatibility for old Xoops versions   
    
$xoopsTpl->assign('xoops_meta_keywords'$meta_keywords);   
    
$xoopsTpl->assign('xoops_meta_description'$meta_description);   
}   

$xoopsTpl->assign('xoops_pagetitle'$pagetitle);   

//this will only work if your theme is using this smarty variables   
$xoopsTpl->assign'xoops_showlblock'0); //set to 0 to hide left blocks   
$xoopsTpl->assign'xoops_showrblock'0); //set to 0 to hide right blocks   
$xoopsTpl->assign'xoops_showcblock'1); //set to 0 to hide center blocks   
?>   

Testing
[en]Testing[/en]
echo "Hello world"?>


echo $xoopsTpl->fetch'test.html' ); 
?>




test.html
DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
        'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'
>
<
html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<{$xoops_langcode}>" lang="<{$xoops_langcode}>">
<
head>
    <
title><{if $xoops_pagetitle !=''}><{$xoops_pagetitle}> : <{/if}><{$xoops_sitename}>title>
    
    <
meta http-equiv="content-type" content="text/html; charset=<{$xoops_charset}>" />
    <
meta name="keywords" content="<{$meta_keywords}>" />
    <
meta name="description" content="<{$meta_description}>" />
   

    
head>
<
body>
testing
<{$xoops_sitename}>
body>
html>


the content in test.php is display exactly what i would like it to be and multilanguage is working

but the content in my test.html template is not showing in my custom php page




thanks Again..

5
bitcero
Re: Custom PHP Page with no header and footer
  • 2015/2/9 16:56

  • bitcero

  • Quite a regular

  • Posts: 318

  • Since: 2005/11/26


With fetch you need to provide the path where template is located, tah can be a relative path or full path. Relative is when your template is located inside "themes" directory:
$xoopsTpl->fetch("my_theme/mytemplate.tpl");
and full when is located in other place:
$xoopsTpl->fetch(XOOPS_ROOT_PATH '/my/template/path.tpl');

Login

Who's Online

405 user(s) are online (285 user(s) are browsing Support Forums)


Members: 0


Guests: 405


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits