12 thoughts on “Drupal 7 Template Preprocess Functions and TPL Files – Advanced Ubercart Sites #6”

  1. Thank you! I’ve been struggling with preprocess functions for a while, and
    your video gave me a lot of light about it. 

  2. is this also possible with 2 different themes on one site?
    get it working on one theme, but get a “Notice: Undefined variable” error
    message when i try to get it working with the other theme.
    all themes are made from scratch, there’s no subtheme.
    *Edit* got it working now, problem was a typo in the template

    btw excellent tutorial, finaly i did get what i wanted :)

  3. Hi Pete, Thanks again for the great tutorials. Do you know if one can use
    Drupal Panels Module to manipulate UC product page?

  4. I’m very new at drupal (some WordPress experience), but why did you create
    those variables in your preprocess function? To me, it looks like you could
    have just rendered those default key’ed variables in the node template
    file. What did that preprocess function do?

  5. i’m guessing you are talking about the variables like uc_body, uc_image,
    etc? I created the variables in the preprocess function so that we had
    clean variables to use in the template file. You’re right, we could have
    just used drupal_render to render all different content variables in the
    template file. However, by using the preprocess function, we create easy to
    use/read variables which makes the template file easier to maintain
    especially if someone could be taking over for you later on…

  6. Thank you for the reply. That does make sense. Are there any practical
    performance issues with creating new variables, even when editing the
    information? Not sure how huge these variables get.

  7. Pete, thanks for all the great tutorials. They really have helped greatly.
    I have followed this tutorial through and ended up with the follow error.
    Parse error: syntax error, unexpected ‘&’ in
    /home/content/06/10945706/html/drupal/sites/all/themes/uc_merchant/template.php
    on line 16 Any thoughts?

  8. My pleasure. With regards to your Q, to be honest, what is it you are
    looking to do? Display Suite (drupal DOT org / DS) might be the better
    option – allows you to manipulate the output of content types…

  9. only thing i can tell you is there is something wrong on line 16 of your
    template.php file… something to do with your &. Did you forget a bracket
    or something? Depending on what text editor you are using, it may flag the
    error for you.

Leave a Reply

Your email address will not be published. Required fields are marked *