Adding my own code to the footer

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
mathesonian
Posts: 16
Joined: Wed Sep 19, 2012 4:11 pm

Adding my own code to the footer

Post by mathesonian »

We would like to add something like this to the footer of the faq where the text changes and rotates through some support testimonial statements.
I tried to do something with it but I don't quite understand the templates that we use. Adding php code to the index.tpl just prints out the php code in the footer.
I read elsewhere on this forum that was intentional after version 1.6
From what I understand I need to add the code into the index.php and then reference it in the index.tpl but I'm not sure how to do that.
Any help would be appreciated.

Here is the php that calls the file with the text.

Code: Select all

div id="testimonials">
		<ul>
        <?php 
		$xmlFile = '../testimonials/testimonials.xml';
		$xslFile = '../testimonials/transformations.xml';

		$doc = new DOMDocument();
		$xsl = new XSLTProcessor();

		$doc->load($xslFile);
		$xsl->importStyleSheet($doc);

		$doc->load($xmlFile);
		echo $xsl->transformToXML($doc);
		?>
        </ul>
		</div>
	
</div>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="js/script.js"></script>
and here is the js that changes it.

Code: Select all

$(document).ready(function(){

    // Hiding all the testimonials, except for the first one.
    $('#testimonials li').hide().eq(0).show();

    // A self executing named function that loops through the testimonials:
    (function showNextTestimonial(){

        // Wait for 7.5 seconds and hide the currently visible testimonial:
        $('#testimonials li:visible').delay(3500).fadeOut('slow',function(){

            // Move it to the back:
            $(this).appendTo('#testimonials ul');

            // Show the next testimonial:
            $('#testimonials li:first').fadeIn('slow',function(){

                // Call the function again:
                showNextTestimonial();
            });
        });
    })();

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

Re: Adding my own code to the footer

Post by Thorsten »

Hi,

you cannot use PHP in the templates anymore since 2.0, I would suggest to add JS

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