How to change the content of {showCategories}

You made an own skin or theme for phpMyFAQ. You can share it here with others!

Moderator: Thorsten

Post Reply
mobilestimulus
Posts: 3
Joined: Fri May 18, 2012 2:03 am

How to change the content of {showCategories}

Post by mobilestimulus » Fri May 18, 2012 3:57 am

phpMyFAQ 2.7.5

I was wondering where to edit so I can change the content of {showCategories} from:

Code: Select all

<li><a id="category_1" title="This is for any questions NOT covered in the other topics." href="/content/faq_page/index.php?action=show&cat=1">General -</a></li>
	<li><a class="active" id="category_0" title="To discuss anything concerning registration." href="/content/faq_page/index.php?action=show&cat=0">Resistration -</a>
		<ul class="subcat">
		<li><a id="category_9" title="How to use the Sign-Up Page" href="/content/faq_page/index.php?action=show&cat=9">&#149; Sign-Up Page</a></li>
		<li><a id="category_10" title="How to confirm that the address you entered belongs to you." href="/content/faq_page/index.php?action=show&cat=10">&#149; Confirm Your Email Address</a></li>
		<li><a id="category_11" title="How to set your password." href="/content/faq_page/index.php?action=show&cat=11">&#149; Set Your Password</a></li>
		<li><a id="category_12" title="The Last Step." href="/content/faq_page/index.php?action=show&cat=12">&#149; Log-In</a></li>
		</ul>
	</li>
	<li><a id="category_3" title="Questions about the Member Login process." href="/content/faq_page/index.php?action=show&cat=3">Member Login -</a></li>
	<li><a id="category_4" title="Information about the Privacy Policy." href="/content/faq_page/index.php?action=show&cat=4">Privacy Policy -</a></li>
	<li><a id="category_5" title="Information about the T.O.S.(Terms Of Service)." href="/content/faq_page/index.php?action=show&cat=5">T.O.S.(Terms Of Service) -</a></li>
	<li><a id="category_6" title="Information about theF.A.Q.(Frequently Asked Questions) area." href="/content/faq_page/index.php?action=show&cat=6">F.A.Q.(Frequently Asked Questions) Area -</a></li>
	<li><a id="category_7" title="Information about the Contact Us Page." href="/content/faq_page/index.php?action=show&cat=7">Contact Us -</a></li>
	<li><a id="category_8" title="Information about how to use the Chat Area." href="/content/faq_page/index.php?action=show&cat=8">Member Chat -</a></li>
And change to this:

Code: Select all

<a id="category_1" title="This is for any questions NOT covered in the other topics." href="/content/faq_page/index.php?action=show&cat=1">General -</a>
	<a class="active" id="category_0" title="To discuss anything concerning registration." href="/content/faq_page/index.php?action=show&cat=0">Registration -</a>
		<a id="category_9" title="How to use the Sign-Up Page" href="/content/faq_page/index.php?action=show&cat=9">&#149; Sign-Up Page</a>
		<a id="category_10" title="How to confirm that the address you entered belongs to you." href="/content/faq_page/index.php?action=show&cat=10">&#149; Confirm Your Email Address</a>
		<a id="category_11" title="How to set your password." href="/content/faq_page/index.php?action=show&cat=11">&#149; Set Your Password</a>
		<a id="category_12" title="The Last Step." href="/content/faq_page/index.php?action=show&cat=12">&#149; Log-In</a>

	<a id="category_3" title="Questions about the Member Login process." href="/content/faq_page/index.php?action=show&cat=3">Member Login -</a>
	<a id="category_4" title="Information about the Privacy Policy." href="/content/faq_page/index.php?action=show&cat=4">Privacy Policy -</a>
	<a id="category_5" title="Information about the T.O.S.(Terms Of Service)." href="/content/faq_page/index.php?action=show&cat=5">T.O.S.(Terms Of Service) -</a>
	<a id="category_6" title="Information about theF.A.Q.(Frequently Asked Questions) area." href="/content/faq_page/index.php?action=show&cat=6">F.A.Q.(Frequently Asked Questions) Area -</a>
	<a id="category_7" title="Information about the Contact Us Page." href="/content/faq_page/index.php?action=show&cat=7">Contact Us -</a>
	<a id="category_8" title="Information about how to use the Chat Area." href="/content/faq_page/index.php?action=show&cat=8">Member Chat -</a>
Basically, I would like to gain control of what goes where <li></li> and <ul></ul> tags are now.

Thanks for any advice..

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

Re: How to change the content of {showCategories}

Post by Thorsten » Fri May 18, 2012 6:24 am

Hi,

you can find the code in /inc/PMF_Helper/Category.php in the function renderCategoryNavigation()

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

mobilestimulus
Posts: 3
Joined: Fri May 18, 2012 2:03 am

Re: How to change the content of {showCategories}

Post by mobilestimulus » Fri May 18, 2012 11:49 pm

Thank you!

Where can I change the class of the links? I would like to change the links that were <li></li> and <ul></ul> both to individual different classes to match my template.

Also, I would like to know if there is a way that I could add a query string to the end of every link. This would allow me to continue to track affiliates traffic.

Thanks....

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

Re: How to change the content of {showCategories}

Post by Thorsten » Sat May 19, 2012 9:53 am

Hi,

it's in inc/Category.php in the method addCategoryLink()

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

mobilestimulus
Posts: 3
Joined: Fri May 18, 2012 2:03 am

Re: How to change the content of {showCategories}

Post by mobilestimulus » Sat May 19, 2012 6:40 pm

Thank you.

The code I see on the page is here:

Code: Select all

public function addCategoryLink($sids, $categoryId, $categoryName, $description, $hasChildren = false, $isActive = false)
    {
        $url              = sprintf('%saction=show&cat=%d', $sids, $categoryId);
        $oLink            = new PMF_Link(PMF_Link::getSystemRelativeUri().'?'.$url);
        $oLink->id        = 'category_' . $categoryId;
        $oLink->itemTitle = $categoryName;
        $oLink->text      = $categoryName;
        
        if ($hasChildren) {
            $oLink->text .= sprintf(' <img src="%s/images/more.gif" width="11" height="11" alt="%s" style="border: none; vertical-align: middle;" />',
                PMF_Configuration::getInstance()->get('main.referenceURL'),
                $categoryName);
        }
        
        if ($isActive) {
            $oLink->class = 'active';
        }
        
        $oLink->tooltip = $description;
        
        return $oLink->toHtmlAnchor();
    }
How do I change it so the main category links have

Code: Select all

 class="purple"
and sub-category links have

Code: Select all

class="pink"
?

Thanks....

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

Re: How to change the content of {showCategories}

Post by Thorsten » Sun May 20, 2012 10:28 am

Hi,

please add after

Code: Select all

$oLink->text = $categoryName;
the following code:

Code: Select all

$oLink->class = 'special';
and change the line

Code: Select all

$oLink->class = 'active';
to

Code: Select all

$oLink->class = 'active special';
Then add the your CSS defintion to template/default/css/style.css to the lines 203 and following where the category CSS is defined.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist

Post Reply