Help needed on the articles page

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

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

Help needed on the articles page

Post by skumar96 » Wed Nov 23, 2016 11:51 pm

Hello,
i have two questions

Question 1.
in the artikel.php page under the question currently it shows the person who answered the question, date answered and comments. I would like to place the below
Asked By: Date: Answered By: Date: Comments: Print | Send To Friend

Question 2.
I would like to create some pages, like Disclaimer, Terms Of Use, etc. Please help me explaining the complete steps i.e. creating templates, php pages, other functionalities, etc.

Thanks

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

Re: Help needed on the articles page

Post by Thorsten » Thu Nov 24, 2016 8:32 pm

Hi,

to add new pages: http://faq.phpmyfaq.de/content/10/9/en/ ... ework.html

To change the FAQ page, you can edit the template file artikel.tpl

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

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

Re: Help needed on the articles page

Post by skumar96 » Fri Nov 25, 2016 7:57 pm

Hello,
You replied question 2 but question 1 is still unanswered.
In the page where a question is displayed (article.php), I want to display the below under the question.
The user who asked the question, the date when the user asked the question, the user or admin who answered the question, the date when the question was answered, comments, views, print the article and send to friend.

Please provide me the template variables for all the above.

Thanks

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

Re: Help needed on the articles page

Post by Thorsten » Fri Nov 25, 2016 9:27 pm

Hi,

sorry! Here it is: https://github.com/thorsten/phpMyFAQ/bl ... pl#L10-L25

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

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

Re: Help needed on the articles page

Post by skumar96 » Mon Nov 28, 2016 9:08 pm

Dear Thorsten,
i think i am not able to explain you clearly. In the current setup in the artikel.tpl file under the question currently it shows
username (the person who answered the question) date (the date when the question was answered) comments (the link to post comments)

What i want to display is

username (the person who asked the question) || date (the date when the question was asked) || username (the person who answered the question) || date (the date when the question was answered) || comments (the link to post comments) || print || send to friend

Thanks
Sapan

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

Re: Help needed on the articles page

Post by Thorsten » Wed Nov 30, 2016 7:42 pm

Hi Sapan,

we do not have the info which user asked the question and when the user asked the question.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

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

Re: Help needed on the articles page

Post by skumar96 » Wed Nov 30, 2016 9:01 pm

how can i add the Print and Send To Friend options


Thanks

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

Re: Help needed on the articles page

Post by Thorsten » Mon Dec 05, 2016 8:12 pm

Hi,

you could use the HTML snippets from catandtag.tpl

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

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

Re: Help needed on the articles page

Post by skumar96 » Tue Dec 06, 2016 12:42 am

Tried but didn't work except the print. Send to friend and pdf options not working. Below is the file

artikle.tpl
<section>
<article class="pmf-faq">
<header>
<div class="pull-right hidden-print" id="solution_id">
<a class="label label-info" href="{solution_id_link}">
ID #{solution_id}
</a>
</div>
<h2>{writeThema}</h2>
<div class="pmf-faq-meta clearfix">
<div class="pmf-faq-author">
<i aria-hidden="true" class="fa fa-user"></i>
<span class="data">{writeAuthor}</span>
</div>
<div class="pmf-faq-date">
<i aria-hidden="true" class="fa fa-calendar"></i>
<span class="data">{writeDateMsg}</span>
</div>
<div class="pmf-faq-comments">
<i aria-hidden="true" class="fa fa-comments"></i>
<span class="data"><a class="show-comment-form" href="#">{numberOfComments}</a></span>
</div>
<div class="pmf-faq-edit">
{editThisEntry}
</div>
</div>
</header>

<div class="pmf-faq-body">

{writeContent}

[tagsAvailable]
{renderTags}
[/tagsAvailable]
[privateNotes]
<div class="pmf-private-notes">
<h4>
{notesHeader}
</h4>
<p>
{notes}
</p>
</div>
[/privateNotes]
[relatedFaqs]
<aside id="faqAccordion" class="accordion related-faqs hidden-print">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" href="#collapseRelatedFaqs" data-parent="#faqAccordion" data-toggle="collapse">
{renderRelatedArticlesHeader}
</a>
</div>
<div id="collapseRelatedFaqs" class="accordion-body collapse">
<div class="accordion-inner">{renderRelatedArticles}</div>
</div>
</div>
</aside>
[/relatedFaqs]
[relatedCategories]
<aside id="faqAccordion" class="accordion related-categories hidden-print">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" href="#collapseRelatedCategories" data-parent="#faqAccordion" data-toggle="collapse">
{renderRelatedCategoriesHeader}
</a>
</div>
<div id="collapseRelatedCategories" class="accordion-body collapse">
<div class="accordion-inner">{renderRelatedCategories}</div>
</div>
</div>
</aside>
[/relatedCategories]

</div>

</article>

<ul id="tab" class="nav nav-tabs hidden-print">
<li class="active"><a href="#votingForm" data-toggle="tab">{msgVoteUseability}</a></li>
[switchLanguage]
<li><a href="#switchAvailableLanguage" data-toggle="tab">{msgChangeLanguage}</a></li>
[/switchLanguage]
[addTranslation]
<li><a href="#addTranslation" data-toggle="tab">{msgTranslate}</a></li>
[/addTranslation]
</ul>

<div class="tab-content pmf-faq-info">
<div class="tab-pane active hidden-print" id="votingForm">
<form action="#" method="post" class="form-inline">
<input type="hidden" name="artikel" value="{saveVotingID}">
<div id="votings"></div>
<div class="pmf-stars">
<div class="pmf-star-rating" data-rating="{msgAverageVote}">
<span data-stars="5">☆</span>
<span data-stars="4">☆</span>
<span data-stars="3">☆</span>
<span data-stars="2">☆</span>
<span data-stars="1">☆</span>
</div>
</div>

<div class="pull-right">
<strong>{msgAverageVote}</strong><span id="rating">{printVotings}</span>
</div>
</form>
</div>
<div class="tab-pane hidden-print" id="switchAvailableLanguage">
{switchLanguage}
</div>
<div class="tab-pane hidden-print" id="addTranslation">
<form action="{translationUrl}" method="post" class="form-inline" accept-charset="utf-8">
{languageSelection}
<button class="btn btn-primary" type="submit" name="submit">
{msgTranslateSubmit}
</button>
</form>
</div>
</div>

<p class="hidden-print">{writeCommentMsg}</p>

<aside class="pmf-create-comment hide" id="pmf-create-comment">

<hr>

<div id="loader"></div>

<h2><i aria-hidden="true" class="fa fa-heart"></i> {msgCommentHeader}</h2>

<form id="formValues" action="#" method="post" class="form-horizontal" accept-charset="utf-8">
<input type="hidden" name="id" id="id" value="{id}">
<input type="hidden" name="lang" id="lang" value="{lang}">
<input type="hidden" name="type" id="type" value="faq">

<div class="row">
<div class="col-md-6">
<input type="text" name="user" id="user" class="form-control input-lg" required
placeholder="{msgNewContentName}" value="{defaultContentName}">
</div>
<div class="col-md-6">
<input type="email" name="mail" id="mail" class="form-control input-lg" required
placeholder="{msgNewContentMail}" value="{defaultContentMail}">
</div>
</div>

<textarea rows="10" name="comment_text" id="comment_text" class="form-control input-lg"
placeholder="{msgYourComment}"></textarea>

{captchaFieldset}

<div class="pmf-buttons clearfix">
<button class="btn btn-primary" id="submitcomment" type="submit">
{msgNewContentSubmit}
</button>
</div>
</form>
</aside>

<aside class="pmf-comments" id="comments">
<hr>
{writeComments}
</aside>

</section>

<script src="assets/js/libs/highlight.pack.js"></script>
<link rel="stylesheet" href="assets/js/libs/default.css">
<script>
$(document).ready(function() {
$(function() {
$('div.pmf-stars > div.pmf-star-rating > span').on('click', function(e) {
var numStars = $(e.target).data('stars');
saveVoting('faq', {id}, numStars, '{lang}');
});
});
$('pre code').each(function(i, block) {
hljs.highlightBlock(block);
});
});
</script>
Thanks

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

Re: Help needed on the articles page

Post by Thorsten » Tue Dec 06, 2016 8:27 pm

Hi,

how should this work, there's no code for the PDF link in it?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

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

Re: Help needed on the articles page

Post by skumar96 » Tue Dec 06, 2016 10:28 pm

Please guide me, how should it work (pdf and send to friend)

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

Re: Help needed on the articles page

Post by Thorsten » Sat Dec 10, 2016 8:00 pm

Hi,

please tell me what you exactly need and I can post the solution here.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

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

Re: Help needed on the articles page

Post by skumar96 » Sat Dec 10, 2016 8:31 pm

Hello,
i need the the Print and Send To Friend option be available under a question which is answered (artikel.tpl & artikel.php) page along with the below
username (the person who asked the question) || date (the date when the question was asked) || username (the person who answered the question) || date (the date when the question was answered) || comments (the link to post comments) || print || send to friend


I added the print and send to friend options but nothing is coming up as explained in the previous communication along with the code.

Thanks

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

Re: Help needed on the articles page

Post by Thorsten » Sun Dec 11, 2016 9:27 pm

Hi,
username (the person who asked the question)
This is not possible.
date (the date when the question was asked)


This is not possible.
username (the person who answered the question)
This is the quthor, the information is present.
date (the date when the question was answered)


This information is present.
comments (the link to post comments)


This information is present.
I added the print and send to friend options but nothing is coming up as explained in the previous communication along with the code.
artikel.tpl:

Code: Select all

<section>
            <article class="pmf-faq">
                <header>
                    <div class="pull-right hidden-print" id="solution_id">
                        <a class="label label-info" href="{solution_id_link}">
                            ID #{solution_id}
                        </a>
                    </div>
                    <h1>{writeThema}</h1>
                    <div class="pmf-faq-meta clearfix">
                        <div class="pmf-faq-author">
                            <i aria-hidden="true" class="fa fa-user"></i>
                            <span class="data">{writeAuthor}</span>
                        </div>
                        <div class="pmf-faq-date">
                            <i aria-hidden="true" class="fa fa-calendar"></i>
                            <span class="data">{writeDateMsg}</span>
                        </div>
                        <div class="pmf-faq-comments">
                            <i aria-hidden="true" class="fa fa-comments"></i>
                            <span class="data"><a class="show-comment-form" href="#">{numberOfComments}</a></span>
                        </div>
                        <div class="pmf-faq-edit">
                            {editThisEntry}
                        </div>
                        <div>
                            <a href="javascript:window.print();" rel="nofollow" title="{writePrintMsgTag}">
                                <span class="fa-stack fa-lg">
                                    <i aria-hidden="true" class="fa fa-square-o fa-stack-2x"></i>
                                    <i aria-hidden="true" class="fa fa-print fa-stack-1x"></i>
                                </span>
                            </a>
                        </div>
                        <div>
                            <a href="{link_email}" title="{writeSend2FriendMsgTag}">
                                <span class="fa-stack fa-lg">
                                    <i aria-hidden="true" class="fa fa-square-o fa-stack-2x"></i>
                                    <i aria-hidden="true" class="fa fa-envelope fa-stack-1x"></i>
                                </span>
                            </a>
                        </div>
                    </div>
                </header>
                <div class="pmf-faq-body">

                    {writeContent}

                    [tagsAvailable]
                    {renderTags}
                    [/tagsAvailable]
                    [privateNotes]
                    <div class="pmf-private-notes">
                        <h4>
                            {notesHeader}
                        </h4>
                        <p>
                            {notes}
                        </p>
                    </div>
                    [/privateNotes]
                    [relatedFaqs]
                    <aside id="faqAccordion" class="accordion related-faqs hidden-print">
                        <div class="accordion-group">
                            <div class="accordion-heading">
                                <a class="accordion-toggle" href="#collapseRelatedFaqs" data-parent="#faqAccordion" data-toggle="collapse">
                                    {renderRelatedArticlesHeader}
                                </a>
                            </div>
                            <div id="collapseRelatedFaqs" class="accordion-body collapse">
                                <div class="accordion-inner">{renderRelatedArticles}</div>
                            </div>
                        </div>
                    </aside>
                    [/relatedFaqs]
                    [relatedCategories]
                    <aside id="faqAccordion" class="accordion related-categories hidden-print">
                        <div class="accordion-group">
                            <div class="accordion-heading">
                                <a class="accordion-toggle" href="#collapseRelatedCategories" data-parent="#faqAccordion" data-toggle="collapse">
                                    {renderRelatedCategoriesHeader}
                                </a>
                            </div>
                            <div id="collapseRelatedCategories" class="accordion-body collapse">
                                <div class="accordion-inner">{renderRelatedCategories}</div>
                            </div>
                        </div>
                    </aside>
                    [/relatedCategories]

                </div>

            </article>

            <ul id="tab" class="nav nav-tabs hidden-print">
                <li class="active"><a href="#votingForm" data-toggle="tab">{msgVoteUseability}</a></li>
                [switchLanguage]
                <li><a href="#switchAvailableLanguage" data-toggle="tab">{msgChangeLanguage}</a></li>
                [/switchLanguage]
                [addTranslation]
                <li><a href="#addTranslation" data-toggle="tab">{msgTranslate}</a></li>
                [/addTranslation]
            </ul>

            <div class="tab-content pmf-faq-info">
                <div class="tab-pane active hidden-print" id="votingForm">
                    <form action="#" method="post" class="form-inline">
                        <input type="hidden" name="artikel" value="{saveVotingID}">
                        <div id="votings"></div>
                        <div class="pmf-stars">
                            <div class="pmf-star-rating" data-rating="{msgAverageVote}">
                                <span data-stars="5">☆</span>
                                <span data-stars="4">☆</span>
                                <span data-stars="3">☆</span>
                                <span data-stars="2">☆</span>
                                <span data-stars="1">☆</span>
                            </div>
                        </div>

                        <div class="pull-right">
                            <strong>{msgAverageVote}</strong><span id="rating">{printVotings}</span>
                        </div>
                    </form>
                </div>
                <div class="tab-pane hidden-print" id="switchAvailableLanguage">
                    {switchLanguage}
                </div>
                <div class="tab-pane hidden-print" id="addTranslation">
                    <form action="{translationUrl}" method="post" class="form-inline" accept-charset="utf-8">
                        {languageSelection}
                        <button class="btn btn-primary" type="submit" name="submit">
                            {msgTranslateSubmit}
                        </button>
                    </form>
                </div>
            </div>

            <p class="hidden-print">{writeCommentMsg}</p>

            <aside class="pmf-create-comment hide" id="pmf-create-comment">

                <hr>

                <div id="loader"></div>

                <h2><i aria-hidden="true" class="fa fa-heart"></i> {msgCommentHeader}</h2>

                <form id="formValues" action="#" method="post" class="form-horizontal" accept-charset="utf-8">
                    <input type="hidden" name="id" id="id" value="{id}">
                    <input type="hidden" name="lang" id="lang" value="{lang}">
                    <input type="hidden" name="type" id="type" value="faq">

                    <div class="row">
                        <div class="col-md-6">
                            <input type="text" name="user" id="user" class="form-control input-lg" required
                                   placeholder="{msgNewContentName}" value="{defaultContentName}">
                        </div>
                        <div class="col-md-6">
                            <input type="email" name="mail" id="mail" class="form-control input-lg" required
                                   placeholder="{msgNewContentMail}"  value="{defaultContentMail}">
                        </div>
                    </div>

                    <textarea rows="10" name="comment_text" id="comment_text" class="form-control input-lg"
                              placeholder="{msgYourComment}"></textarea>

                    {captchaFieldset}
                    
                    <div class="pmf-buttons clearfix">
                        <button class="btn btn-primary" id="submitcomment" type="submit">
                            {msgNewContentSubmit}
                        </button>
                    </div>
                </form>
            </aside>

            <aside class="pmf-comments" id="comments">
                <hr>
                {writeComments}
            </aside>

        </section>

        <script src="assets/js/libs/highlight.pack.js"></script>
        <link rel="stylesheet" href="assets/js/libs/default.css">
        <script>
            $(document).ready(function() {
                $(function() {
                    $('div.pmf-stars > div.pmf-star-rating > span').on('click', function(e) {
                        var numStars = $(e.target).data('stars');
                        saveVoting('faq', {id}, numStars, '{lang}');
                    });
                });
                $('pre code').each(function(i, block) {
                    hljs.highlightBlock(block);
                });
            });
        </script>
artikel.php:

Code: Select all

<?php

/**
 * Shows the page with the FAQ record and - when available - the user comments.
 *
 * PHP Version 5.5
 *
 * This Source Code Form is subject to the terms of the Mozilla Public License,
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
 * obtain one at http://mozilla.org/MPL/2.0/.
 *
 * @category  phpMyFAQ
 *
 * @author    Thorsten Rinne <thorsten@phpmyfaq.de>
 * @author    Lars Tiedemann <larstiedemann@yahoo.de>
 * @copyright 2002-2016 phpMyFAQ Team
 * @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
 *
 * @link      http://www.phpmyfaq.de
 * @since     2002-08-27
 */
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();
}

$captcha = new PMF_Captcha($faqConfig);
$oGlossary = new PMF_Glossary($faqConfig);
$faqTagging = new PMF_Tags($faqConfig);
$faqRelation = new PMF_Relation($faqConfig);
$faqRating = new PMF_Rating($faqConfig);
$faqComment = new PMF_Comment($faqConfig);
$markDown = new ParsedownExtra();
$faqHelper = new PMF_Helper_Faq($faqConfig);

if (is_null($user)) {
    $user = new PMF_User_CurrentUser($faqConfig);
}

$faqSearchResult = new PMF_Search_Resultset($user, $faq, $faqConfig);

$captcha->setSessionId($sids);
if (!is_null($showCaptcha)) {
    $captcha->showCaptchaImg();
    exit;
}

$currentCategory = $cat;

$recordId = PMF_Filter::filterInput(INPUT_GET, 'id', FILTER_VALIDATE_INT);
$solutionId = PMF_Filter::filterInput(INPUT_GET, 'solution_id', FILTER_VALIDATE_INT);

// Get all data from the FAQ record
if (0 == $solutionId) {
    $faq->getRecord($recordId);
} else {
    $faq->getRecordBySolutionId($solutionId);
}
$recordId = $faq->faqRecord['id'];

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

$faqVisits = new PMF_Visits($faqConfig);
$faqVisits->logViews($recordId);

// Add Glossary entries for answers only
$question = $faq->getRecordTitle($recordId);
if ($faqConfig->get('main.enableMarkdownEditor')) {
    $answer = $markDown->text($faq->faqRecord['content']);
} else {
    $answer = $faq->faqRecord['content'];
}
$answer = $oGlossary->insertItemsIntoContent($answer);

// Set the path of the current category
$categoryName = $category->getPath($currentCategory, ' &raquo; ', true);

$highlight = PMF_Filter::filterInput(INPUT_GET, 'highlight', FILTER_SANITIZE_STRIPPED);
if (!is_null($highlight) && $highlight != '/' && $highlight != '<' && $highlight != '>' && PMF_String::strlen($highlight) > 3) {
    $highlight = str_replace("'", '´', $highlight);
    $highlight = str_replace(array('^', '.', '?', '*', '+', '{', '}', '(', ')', '[', ']'), '', $highlight);
    $highlight = preg_quote($highlight, '/');
    $searchItems = explode(' ', $highlight);

    foreach ($searchItems as $item) {
        if (PMF_String::strlen($item) > 2) {
            $question = PMF_Utils::setHighlightedString($question, $item);
            $answer = PMF_Utils::setHighlightedString($answer, $item);
        }
    }
}

$linkVerifier = new PMF_Linkverifier($faqConfig);
$linkArray = $linkVerifier->getUrlpool();
if (isset($linkArray['href'])) {
    foreach (array_unique($linkArray['href']) as $_url) {
        $xpos = strpos($_url, 'index.php?action=artikel');
        if (!($xpos === false)) {
            // Get the Faq link title
            $matches = array();
            preg_match('/id=([\d]+)/ism', $_url, $matches);
            $_id = $matches[1];
            $_title = $faq->getRecordTitle($_id);
            $_link = substr($_url, $xpos + 9);
            if (strpos($_url, '&') === false) {
                $_link = str_replace('&', '&', $_link);
            }
            $oLink = new PMF_Link(PMF_Link::getSystemRelativeUri().$_link, $faqConfig);
            $oLink->itemTitle = $oLink->tooltip = $_title;
            $newFaqPath = $oLink->toString();
            $answer = str_replace($_url, $newFaqPath, $answer);
        }
    }
}

// List all faq attachments
if ($faqConfig->get('records.disableAttachments') && 'yes' == $faq->faqRecord['active']) {
    $attList = PMF_Attachment_Factory::fetchByRecordId($faqConfig, $recordId);
    $outstr = '';

    while (list(, $att) = each($attList)) {
        $outstr .= sprintf('<a href="%s">%s</a>, ',
            $att->buildUrl(),
            $att->getFilename());
    }
    if (count($attList) > 0) {
        $answer .= '<p>'.$PMF_LANG['msgAttachedFiles'].' '.PMF_String::substr($outstr, 0, -2).'</p>';
    }
}

// List all categories for this faq
$htmlAllCategories = '';
$multiCategories = $category->getCategoriesFromArticle($recordId);
if (count($multiCategories) > 1) {
    foreach ($multiCategories as $multiCat) {
        $path = $category->getPath($multiCat['id'], ' &raquo; ', true, 'breadcrumb-related-categories');
        if ('' === trim($path)) {
            continue;
        }
        $htmlAllCategories .= $path;
    }
}

// Related FAQs
$faqSearchResult->reviewResultset(
    $faqRelation->getAllRelatedById(
        $recordId,
        $faq->faqRecord['title'],
        $faq->faqRecord['keywords']
    )
);

$searchHelper = new PMF_Helper_Search($faqConfig);
$relatedFaqs = $searchHelper->renderRelatedFaqs($faqSearchResult, $recordId);

// Show link to edit the faq?
$editThisEntry = '';
if ($user->perm->checkRight($user->getUserId(), 'editbt')) {
    $editThisEntry = sprintf(
        '<i aria-hidden="true" class="fa fa-edit"></i> <a class="data" href="%sadmin/index.php?action=editentry&id=%d&lang=%s">%s</a>',
        PMF_Link::getSystemRelativeUri('index.php'),
        $recordId,
        $lang,
        $PMF_LANG['ad_entry_edit_1'].' '.$PMF_LANG['ad_entry_edit_2']
    );
}

// Is the faq expired?
$expired = (date('YmdHis') > $faq->faqRecord['dateEnd']);

// Does the user have the right to add a comment?
if ((-1 === $user->getUserId() && !$faqConfig->get('records.allowCommentsForGuests')) ||
    ($faq->faqRecord['active'] === 'no') || ('n' === $faq->faqRecord['comment']) || $expired) {
    $commentMessage = $PMF_LANG['msgWriteNoComment'];
} else {
    $commentMessage = sprintf(
        '%s<a href="#" class="show-comment-form">%s</a>',
        $PMF_LANG['msgYouCan'],
        $PMF_LANG['msgWriteComment']);
}

$translationUrl = sprintf(
    str_replace(
        '%',
        '%%',
        PMF_Link::getSystemRelativeUri('index.php')
    ).'index.php?%saction=translate&cat=%s&id=%d&srclang=%s',
    $sids,
    $currentCategory,
    $recordId,
    $lang
);

$availableLanguages = $faqConfig->getLanguage()->languageAvailable($faq->faqRecord['id']);

if (!empty($availableLanguages) && count($availableLanguages) > 1) {
    $tpl->parseBlock(
        'writeContent',
        'switchLanguage',
        array(
            'msgChangeLanguage' => $PMF_LANG['msgLangaugeSubmit'],
        )
    );
}

if ($user->perm->checkRight($user->getUserId(), 'addtranslation')) {
    $tpl->parseBlock(
        'writeContent',
        'addTranslation',
        array(
            'msgTranslate' => $PMF_LANG['msgTranslate'],
        )
    );
}

if ($user->perm->checkRight($user->getUserId(), 'editbt') && !empty($faq->faqRecord['notes'])) {
    $tpl->parseBlock(
        'writeContent',
        'privateNotes',
        [
            'notesHeader' => $PMF_LANG['ad_admin_notes'],
            'notes' => $faq->faqRecord['notes']
        ]
    );
}

if ('-' !== $faqTagging->getAllLinkTagsById($recordId)) {
    $tpl->parseBlock(
        'writeContent',
        'tagsAvailable',
        array(
            'renderTags' => $PMF_LANG['msg_tags'].': '.$faqTagging->getAllLinkTagsById($recordId),
        )
    );
}

if ('' !== $htmlAllCategories) {
    $tpl->parseBlock(
        'writeContent',
        'relatedCategories',
        array(
            'renderRelatedCategoriesHeader' => $PMF_LANG['msgArticleCategories'],
            'renderRelatedCategories' => $htmlAllCategories,
        )
    );
}

if ('' !== $relatedFaqs) {
    $tpl->parseBlock(
        'writeContent',
        'relatedFaqs',
        array(
            'renderRelatedArticlesHeader' => $PMF_LANG['msg_related_articles'],
            'renderRelatedArticles' => $relatedFaqs,
        )
    );
}

$date = new PMF_Date($faqConfig);
$captchaHelper = new PMF_Helper_Captcha($faqConfig);

$numComments = $faqComment->getNumberOfComments();

$tpl->parse(
    'writeContent',
    array(
        'baseHref' => $faqSystem->getSystemUri($faqConfig),
        'writeRubrik' => $categoryName,
        'solution_id' => $faq->faqRecord['solution_id'],
        'solution_id_link' => PMF_Link::getSystemRelativeUri().'?solution_id='.$faq->faqRecord['solution_id'],
        'writeThema' => $question,
        'writeContent' => $answer,
        'writeDateMsg' => $date->format($faq->faqRecord['date']),
        'writeAuthor' => $faq->faqRecord['author'],
        'numberOfComments' => sprintf(
            '%d %s',
            isset($numComments[$recordId]) ? $numComments[$recordId] : 0,
            $PMF_LANG['ad_start_comments']
        ),
        'editThisEntry' => $editThisEntry,
        'translationUrl' => $translationUrl,
        'languageSelection' => PMF_Language::selectLanguages($LANGCODE, false, $availableLanguages, 'translation'),
        'msgTranslateSubmit' => $PMF_LANG['msgTranslateSubmit'],
        'saveVotingPATH' => sprintf(
            str_replace(
                '%',
                '%%',
                PMF_Link::getSystemRelativeUri('index.php')
            ).'index.php?%saction=savevoting',
            $sids
        ),
        'saveVotingID' => $recordId,
        'saveVotingIP' => $_SERVER['REMOTE_ADDR'],
        'msgAverageVote' => $PMF_LANG['msgAverageVote'],
        'renderVotingStars' => '',
        'printVotings' => $faqRating->getVotingResult($recordId),
        'switchLanguage' => $faqHelper->renderChangeLanguageSelector($faq, $currentCategory),
        'msgVoteUseability' => $PMF_LANG['msgVoteUseability'],
        'msgVoteBad' => $PMF_LANG['msgVoteBad'],
        'msgVoteGood' => $PMF_LANG['msgVoteGood'],
        'msgVoteSubmit' => $PMF_LANG['msgVoteSubmit'],
        'writeCommentMsg' => $commentMessage,
        'msgWriteComment' => $PMF_LANG['msgWriteComment'],
        'id' => $recordId,
        'lang' => $lang,
        'msgCommentHeader' => $PMF_LANG['msgCommentHeader'],
        'msgNewContentName' => $PMF_LANG['msgNewContentName'],
        'msgNewContentMail' => $PMF_LANG['msgNewContentMail'],
        'defaultContentMail' => ($user instanceof PMF_User_CurrentUser) ? $user->getUserData('email') : '',
        'defaultContentName' => ($user instanceof PMF_User_CurrentUser) ? $user->getUserData('display_name') : '',
        'msgYourComment' => $PMF_LANG['msgYourComment'],
        'msgNewContentSubmit' => $PMF_LANG['msgNewContentSubmit'],
        'captchaFieldset' => $captchaHelper->renderCaptcha($captcha, 'writecomment', $PMF_LANG['msgCaptcha'], $auth),
        'writeComments' => $faqComment->getComments($recordId, PMF_Comment::COMMENT_TYPE_FAQ),
        'msg_about_faq' => $PMF_LANG['msg_about_faq'],
        'link_email' => $faqServices->getSuggestLink(),
    )
);

$tpl->parseBlock(
    'index',
    'breadcrumb',
    [
        'breadcrumbHeadline' => $categoryName
    ]
);
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

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

Re: Help needed on the articles page

Post by skumar96 » Thu Dec 15, 2016 12:10 am

Hello Thorsten,
i think there is some error in the code maybe in artikle.tpl or artikle.php
I am getting a blank page after i copied everything in their respective files.

Thanks

Post Reply