Add php into phpmyfaq

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

stingone
Posts: 25
Joined: Tue Jun 21, 2011 11:31 am

Re: Add php into phpmyfaq

Post by stingone »

Thorsten wrote:Hi,

please try this:

Code: Select all

if (isset($_SESSION['user_id'])) {
   $links_template_vars = array(
   "test"               => '<a href="index.php?'.$sids.'action=test">Test</a>');
} else {
   $links_template_vars = array(
   "test"               => 'not true');
}

if (checkAdmin()) {
   $links_template_vars = array(
   "test1"               => '<a href="index.php?'.$sids.'action=test">Test1</a>');
} else {
   $links_template_vars = array(
   "test"               => 'not true');
}
bye
Thorsten
Hi,

Just test it and now it shows al the links { link } but i get the value not true on test1. its just if the included file in on the top of the index.php is not communicate with the variables.
stingone
Posts: 25
Joined: Tue Jun 21, 2011 11:31 am

Re: Add php into phpmyfaq

Post by stingone »

Almost there :)

I implemented the

Code: Select all

include '../login/dbc.php';
page_protect();
session_start();
In line 382. And now have

Code: Select all

else if ($_SESSION['user_id']) {
    $links_template_vars = array(
below that i have if

Code: Select all

 if (checkAdmin()) {
   $links_template_vars = array(
   "test"               => '<a href="index.php">Test1</a>');
}
else $links_template_vars = array(
   "test"               => '');
Ok what happens now if that when i log in as admin. The link admin wil show up but al the other links wil shown as {link} when i login as not admin the menu works but the admin section wil shown up as {test} it has something to do with the if statement just if it only pharse on of the 2 if statements instead of checking and pharsing both....
stingone
Posts: 25
Joined: Tue Jun 21, 2011 11:31 am

Re: Add php into phpmyfaq

Post by stingone »

OWkee got it working :P

last question,

what does ($faqconfig->get('main.enableRewriteRules')) refering to html page's but cant find them in the folders.

I deleted it to get my part working. i now have.

Code: Select all

if ((checkAdmin()) && ($_SESSION['user_id'])) {
   $links_template_vars = array(
   		"admin"                => '<a href="index.php">Admin</a>',
   	"faqHome"             => $faqconfig->get('main.referenceURL'),
        "msgSearch"           => '<a href="index.php?'.$sids.'action=search">'.$PMF_LANG["msgAdvancedSearch"].'</a>',
        "msgAddContent"       => '<a href="index.php?'.$sids.'action=add">'.$PMF_LANG["msgAddContent"].'</a>',
        "msgQuestion"         => '<a href="index.php?'.$sids.'action=ask">'.$PMF_LANG["msgQuestion"].'</a>',
        "msgOpenQuestions"    => '<a href="index.php?'.$sids.'action=open">'.$PMF_LANG["msgOpenQuestions"].'</a>',
        "msgHelp"             => '<a href="index.php?'.$sids.'action=help">'.$PMF_LANG["msgHelp"].'</a>',
        "msgContact"          => '<a href="index.php?'.$sids.'action=contact">'.$PMF_LANG["msgContact"].'</a>',
        "allCategories"       => '<a href="index.php?'.$sids.'action=show">'.$PMF_LANG["msgShowAllCategories"].'</a>',
        "backToHome"          => '<a href="index.php?'.$sids.'">'.$PMF_LANG["msgHome"].'</a>',
        'showInstantResponse' => '<a href="index.php?'.$sids.'action=instantresponse">'.$PMF_LANG['msgInstantResponse'].'</a>',
        'showSitemap'         => '<a href="index.php?'.$sids.'action=sitemap&lang='.$LANGCODE.'">'.$PMF_LANG['msgSitemap'].'</a>',
		"mijnaccount"         => '<a href="mysettings.php">Mijn Account</a>',
  	        "loguit"              => '<a href="logout.php">Uitloggen</a>',
        'opensearch'          => $systemUri . 'opensearch.php');
}
else if ($_SESSION['user_id']) {
    $links_template_vars = array(
   	"admin"               => '',
   	"faqHome"             => $faqconfig->get('main.referenceURL'),
        "msgSearch"           => '<a href="index.php?'.$sids.'action=search">'.$PMF_LANG["msgAdvancedSearch"].'</a>',
        "msgAddContent"       => '<a href="index.php?'.$sids.'action=add">'.$PMF_LANG["msgAddContent"].'</a>',
        "msgQuestion"         => '<a href="index.php?'.$sids.'action=ask">'.$PMF_LANG["msgQuestion"].'</a>',
        "msgOpenQuestions"    => '<a href="index.php?'.$sids.'action=open">'.$PMF_LANG["msgOpenQuestions"].'</a>',
        "msgHelp"             => '<a href="index.php?'.$sids.'action=help">'.$PMF_LANG["msgHelp"].'</a>',
        "msgContact"          => '<a href="index.php?'.$sids.'action=contact">'.$PMF_LANG["msgContact"].'</a>',
        "allCategories"       => '<a href="index.php?'.$sids.'action=show">'.$PMF_LANG["msgShowAllCategories"].'</a>',
        "backToHome"          => '<a href="index.php?'.$sids.'">'.$PMF_LANG["msgHome"].'</a>',
        'showInstantResponse' => '<a href="index.php?'.$sids.'action=instantresponse">'.$PMF_LANG['msgInstantResponse'].'</a>',
        'showSitemap'         => '<a href="index.php?'.$sids.'action=sitemap&lang='.$LANGCODE.'">'.$PMF_LANG['msgSitemap'].'</a>',
	          "mijnaccount"         => '<a href="mysettings.php">Mijn Account</a>',
  	          "loguit"              => '<a href="logout.php">Uitloggen</a>',
        'opensearch'          => $systemUri . 'opensearch.php');

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

Re: Add php into phpmyfaq

Post by Thorsten »

Hi,

if you enable mod_rewrite in your Apache, in the phpMyFAQ configuration and rename the _.htaccess file to .htaccess you get nicer URLs

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
stingone
Posts: 25
Joined: Tue Jun 21, 2011 11:31 am

Re: Add php into phpmyfaq

Post by stingone »

doesnt work,

when clicking link i get error file not found .... it is putting the path phpmyfaq in front of the url

The requested URL /phpmyfaq/index.php was not found on this server.
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Add php into phpmyfaq

Post by Thorsten »

Hi,

did you rename the _.htaccess to .htaccess and corrected the path? Did you enable the rewriting in the configuration?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply