Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7533255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:41:04+00:00 2026-05-30T05:41:04+00:00

I am trying to work with FatFree framework and trying to use the template

  • 0

I am trying to work with FatFree framework and trying to use the template engine. I render the template with the following code –

echo Template::serve('template.php');

The problem which I’m facing is that, inside the template.php file the F3 tags are recognised but any PHP code doesn’t work. For instance, if I have the following code in the template.php file –

<?php
if (F3::get('var') == 'var1') {
   ?>
   <span>var1 is present</span>
   <?php
} else {
   ?>
   <span>var1 not present</span>
   <?php
}
?>

Here both var1 is present and var1 not present is printed irrespective of the value of var. Also, php for loops are not working – so basically all the php code is not working.

However, if I used <F3:check> to write the above PHP code, then everything works fine. Can we not use PHP code in templates. If this is the case, this is a serious limitation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:41:05+00:00Added an answer on May 30, 2026 at 5:41 am

    I have found the answer, although I don’t really like it.

    There is two different functions, F3::render() and Template::serve()

    With F3::render() you can evaluate PHP expressions and use the F3::get() to retrieve variables. According to the website: "The only issue with embedding PHP code in your templates is the conscious effort needed to stick to MVC principles"

    The Template::serve() is for templating only. Meaning its simply to process the templating language.

    So basically, and yes it sucks and doesn’t make sense, you can evaluate PHP code in the F3::render() and you can’t use templating variables ({{@var}}) -OR- you can use Template::serve() and you are limited to only calling PHP functions, and not truly evaluating PHP code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When trying to work in QtCreator, there is a problem with code completion for
Im trying to work with following code i getting this error at xsltProcessor.importStylesheet Error
just trying to work my way around using Redemption; I've got the following code
I'm trying to work through Project Euler and I'm hitting a barrier on problem
trying to work out how to use constructors with an inherited class. I know
I am trying to work out how to parallelize some code from data mining
I´m trying to work out a problem with registering my configuration classes. I have
I am trying to work out how to write php functions, so that I
Trying to work out a map reduce on mongo that would use field value
After trying to work on someone else's code, and so many different iterations, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.