New to PHP and have a simple (stupid) variable question
Posted: Fri Feb 19, 2010 9:35 pm
I am writing my first application with php (or with any programming language) and I find myself stumped with something that seems very trivial. After writing pages worth of functional but barbaric code I cannot solve this one little problem.
In order to switch templates for my pids, from the index.php I thought that I would just store a portion of the template name in a mysql database which the user selects from a drop down while creating the document, and stick the variable in the include statement to assign the proper template. The problem is that I can easily display the assigned value of other variables within html portion of my site with a <?php echo "{$row['title']}"; ?> or such, however when I try to place the value of $row['template'] within the <php require('templates/($rtemplate).php'); ?> I do not know how to extract the value to complete the path to my template. I tried assigning $row['template'] to $rtemplate to simplify things, and I can echo the results of $rtemplate successfully....
If anyone can tell me how to complete my path, I would be very grateful.....Like every night it seems, I have grown accustomed to staying up all night trying to fix one line of code that is resolved in 5 minutes the next day (after a couple of hours of sleep)....However, even knowing the outcome, I'm sure that I'll be up all night working on this one little detail......Out of curiosity, does that ever go away?
Thanks
In order to switch templates for my pids, from the index.php I thought that I would just store a portion of the template name in a mysql database which the user selects from a drop down while creating the document, and stick the variable in the include statement to assign the proper template. The problem is that I can easily display the assigned value of other variables within html portion of my site with a <?php echo "{$row['title']}"; ?> or such, however when I try to place the value of $row['template'] within the <php require('templates/($rtemplate).php'); ?> I do not know how to extract the value to complete the path to my template. I tried assigning $row['template'] to $rtemplate to simplify things, and I can echo the results of $rtemplate successfully....
If anyone can tell me how to complete my path, I would be very grateful.....Like every night it seems, I have grown accustomed to staying up all night trying to fix one line of code that is resolved in 5 minutes the next day (after a couple of hours of sleep)....However, even knowing the outcome, I'm sure that I'll be up all night working on this one little detail......Out of curiosity, does that ever go away?
Thanks