New Page & Template

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

skumar96
Posts: 48
Joined: Wed Nov 16, 2016 7:27 pm

New Page & Template

Post by skumar96 »

Hello,
i wanted to add a disclaimer under each answer and therefor tried to create a page/template. I followed the link http://faq.phpmyfaq.de/content/2/187/en ... ework.html
1. Build a template file pdrgrossan.tpl and place it in the template/ folder
2. Build a PHP file called pdrgrossan.php and saved it in the root of phpMyFAQ
3. Registerd the variable e.g. "pdrgrossan" in config/constants.php in the array $allowedVariables;
When i tested the page by visiting the link http://www.neilmed.com/askdr/index.php? ... pdrgrossan i get some weird characters on the page (please visit the page to see)

Below is my pdrgrossan.php
<?php
if (!defined('IS_VALID_PHPMYFAQ')) {
$protocol = 'http';
if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
$protocol = 'https';
}
header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']));
exit();
}

try {
$faqsession->userTracking('overview', 0);
} catch (PMF_Exception $e) {
// @todo handle the exception
}

$tpl->parse ('writeContent', array(
'pdrgrossanTitle' => $pdrgrossanTitle,
'pdrgrossanContent' => $pdrgrossanContent
)
);
$tpl->merge('writeContent', 'index');
?>
What i am doing wrong???
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: New Page & Template

Post by Thorsten »

Hi,

I'll get some content encoding errors. Do you have a space or UTF-8 BOM in the first line of the php file?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
skumar96
Posts: 48
Joined: Wed Nov 16, 2016 7:27 pm

Re: New Page & Template

Post by skumar96 »

No. Can you please send me the template file and the php file. The template file should be pdrgrossan.tpl and the PHP file is pdrgrossan.php
As said, i have alreday registered variable e.g. "pdrgrossan" in config/constants.php in the array $allowedVariables;


Thanks
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: New Page & Template

Post by Thorsten »

Hi,

please post the .tpl and the .php file here.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
skumar96
Posts: 48
Joined: Wed Nov 16, 2016 7:27 pm

Re: New Page & Template

Post by skumar96 »

Here are the files
pdrgrossan.php
<?php
if (!defined('IS_VALID_PHPMYFAQ')) {
$protocol = 'http';
if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') {
$protocol = 'https';
}
header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME']));
exit();
}

try {
$faqsession->userTracking('overview', 0);
} catch (PMF_Exception $e) {
// @todo handle the exception
}

$tpl->parse ('writeContent', array(
'pdrgrossanTitle' => $pdrgrossanTitle,
'pdrgrossanContent' => $pdrgrossanContent
)
);
$tpl->merge('writeContent', 'index');
?>

pdrgrossan.tpl
<div align="center"><h5>About Dr. Murray Grossan</h5></div>

<span style="font-family: Arial, sans-serif; color: #000000; font-size: 14px; text-align:justify;">
Murray Grossan M.D. is a Board Certified Ear, Nose & Throat Specialist from Los Angeles. After graduating from the Medical College of Georgia and training at Bellevue Hospital, New York, as an ENT specialist, he has practiced in Los Angeles and is currently at Cedars Medical Center. <br><br>

In 1974, Dr. Grossan developed a pulsating nasal/sinus irrigator by converting a dental floss machine into a nasal irrigator. The research data showed great success with this innovation, and he continued the pursuit of nasal and sinus natural therapies over drugs or surgical treatment. <br><br>

His special interests include therapies for tinnitus, developing snoring relief methods, rejuvenating ancient methods of therapy and various products for scuba divers and people who often fly. At this time, he has written five medical books and 30+ medical journal articles. He has pioneered biofeedback for tinnitus and stress. <br><br>

<i>"I'm very proud to be associated with NeilMed and would like to provide information for various ear, nose and throat concerns. I prefer a drug-free approach whenever possible, especially now when some bacteria are becoming resistant to antibiotics." </i>
<div align="right">-Murray Grossan, MD</div>&nbsp;&nbsp;
<br><br>

Dr. Grossan cannot diagnose or treat you, but will give general information for knowledge purposes. Always make sure to consult with your primary care physician and specialist for all your medical conditions. <br><br>

Thank You.
</span>


<!-- Start Test Content -->
<h2>{pdrgrossanTitle}</h2>
<span>{pdrgrossanContent}</span>
<!-- End Test Content -->
Thanks
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: New Page & Template

Post by Thorsten »

Hi,

where do you set e.g.

Code: Select all

$pdrgrossanTitle
? Did you try to enable the debug mode to check where the errors occur?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
skumar96
Posts: 48
Joined: Wed Nov 16, 2016 7:27 pm

Re: New Page & Template

Post by skumar96 »

I only did the below. I have not set pdrgrossanTitle anywhere as it was not mentioned in the document

1. Build a template file pdrgrossan.tpl and place it in the template/ folder
2. Build a PHP file called pdrgrossan.php and saved it in the root of phpMyFAQ
3. Registerd the variable e.g. "pdrgrossan" in config/constants.php in the array $allowedVariables;


Thanks
usef
Posts: 2
Joined: Sat Dec 10, 2016 6:43 pm

Re: New Page & Template

Post by usef »

skumar96 wrote:I only did the below. I have not set pdrgrossanTitle anywhere as it was not mentioned in the document

1. Build a template file pdrgrossan.tpl and place it in the template/ folder
2. Build a PHP file called pdrgrossan.php and saved it in the root of phpMyFAQ
3. Registerd the variable e.g. "pdrgrossan" in config/constants.php in the array $allowedVariables;


Thanks

I think you need te use this code:

Code: Select all

$pdrgrossanTitle = "pdrgrossanTitle";
$pdrgrossanContent = "pdrgrossanContent";

$tpl->parse(
    'writeContent',
    array(
        'pdrgrossanTitle' => $pdrgrossanTitle,
        'pdrgrossanContent' => $pdrgrossanContent,

    )
);
skumar96
Posts: 48
Joined: Wed Nov 16, 2016 7:27 pm

Re: New Page & Template

Post by skumar96 »

No luck, still the same. Please visit below link.

http://www.neilmed.com/askdr/index.php? ... pdrgrossan
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: New Page & Template

Post by Thorsten »

Hi,

please try to enable the debug mode in inc/Bootstrap.php

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
usef
Posts: 2
Joined: Sat Dec 10, 2016 6:43 pm

Re: New Page & Template

Post by usef »

skumar96 wrote:No luck, still the same. Please visit below link.

http://www.neilmed.com/askdr/index.php? ... pdrgrossan

Which version of phpmyfaq are you using?
skumar96
Posts: 48
Joined: Wed Nov 16, 2016 7:27 pm

Re: New Page & Template

Post by skumar96 »

The latest version 2.9
skumar96
Posts: 48
Joined: Wed Nov 16, 2016 7:27 pm

Re: New Page & Template

Post by skumar96 »

Hello,
if i enable the debug mode in inc/Bootstrap.php, i can see the content and the page is viewed perfectly as it should but if i make it false, same old view of some characters.

Thanks
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: New Page & Template

Post by Thorsten »

Hi,

you can disable the GZIP compression in the admin backend, then it should work.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
skumar96
Posts: 48
Joined: Wed Nov 16, 2016 7:27 pm

Re: New Page & Template

Post by skumar96 »

Hello Thorsten,
still the same problem. I disabled the GZIP compression but still i see the characters on the page instead of the actual content.

Thanks
Post Reply