Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 11-29-2009, 12:46 PM
Arianna's Avatar
Arianna Arianna is offline
Dev Staff
 
Join Date: Sep 2009
Posts: 334
Gender: Female
Credits: 21,277
Arianna will become famous soon enough
Default Converting the Templates to PHP?

I want to convert my templates to PHP, for a feature that I'm making. You see, the theme url is 'blue.php', and it has a few things which are PHP in it.
What, you ask? Well, this is the code in between the head tags:
PHP Code:
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>:BROWSERTITLE:</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<?php
$sql 
"SELECT * FROM ".$prefix."users WHERE username='".$loggedinname."'";
$result mysql_query($sql);        
$myrow mysql_fetch_array($result);
$stylesheet $myrow['style'];
?>
<link rel="stylesheet" media="screen" type="text/css" href="templates/blue/default.css" title="default" />
</head>
I have this working on another site of mine, but the system doesn't seem to be able to read the actual php file - the css link is shown as:
Code:
templates/blue/blue.php<?php echo $stylesheet ?>.css
This is instead of it echoing the variable. What am I doing wrong?
Reply With Quote
  #2  
Old 11-29-2009, 01:24 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 10,699
BMR777 is on a distinguished road
Default RE: Converting the Templates to PHP?

You won't be able to run PHP from the .html template file. The system doesn't work like that. What you can try is make a new template variable, such as :MYCODE: and place that in the template. Then in the adoptables script you do your queries and then use the template system to parse the final result into :MYCODE: so it appears in the template. :)
Reply With Quote
  #3  
Old 11-29-2009, 01:40 PM
Arianna's Avatar
Arianna Arianna is offline
Dev Staff
 
Join Date: Sep 2009
Posts: 334
Gender: Female
Credits: 21,277
Arianna will become famous soon enough
Default RE: Converting the Templates to PHP?

Hmm, however I had it as a PHP file - does this mean that you can't use PHP files as templates? :/
And I'm also assuming that I'd need to put the replacement thing on every php page, right?
Reply With Quote
  #4  
Old 11-29-2009, 01:42 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 10,699
BMR777 is on a distinguished road
Default RE: Converting the Templates to PHP?

I don't think you can use PHP files as templates, however you may be able to use the eval() function with your code to make it execute from a PHP file template. It would be worth looking into, but I doubt it would work.

To use my method then yes, you would have to put it on every page.
Reply With Quote
  #5  
Old 11-29-2009, 01:51 PM
Arianna's Avatar
Arianna Arianna is offline
Dev Staff
 
Join Date: Sep 2009
Posts: 334
Gender: Female
Credits: 21,277
Arianna will become famous soon enough
Default RE: Converting the Templates to PHP?

Okay - I might start that, then, next weekend. It might be some work, but I think that it would be worth it. Is there any way that I could have it as a function or something - say that I changed the theme location - the css thing would change, and I'd need to change all of the files - again. xP Do you get what I mean? xD
Reply With Quote
  #6  
Old 11-30-2009, 03:01 PM
BMR777 BMR777 is offline
Member
 
Join Date: Jan 2011
Posts: 1,122
Gender: Male
Credits: 10,699
BMR777 is on a distinguished road
Default RE: Converting the Templates to PHP?

Yeah, I see what you mean and that is something I am working on as well. :)

I'll let you know if I get it working. :)
Reply With Quote
  #7  
Old 12-01-2009, 12:09 AM
Arianna's Avatar
Arianna Arianna is offline
Dev Staff
 
Join Date: Sep 2009
Posts: 334
Gender: Female
Credits: 21,277
Arianna will become famous soon enough
Default RE: Converting the Templates to PHP?

I finished the whole system yesterday! Apart from the fact that my FTP program thought it would be funny if it scrambled and squished together the last lines in some files (I still can't find out why), it works. I'll post a tutorial, either here or in the donators forum, to show how to do it. :)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Rodent/Rat Templates AlexC Art Gallery 0 04-12-2011 01:24 PM
Converting a layout? Rozel Questions and Supports 1 03-29-2011 10:28 PM
Templates CrystalShards Suggestions and Feature Requests 1 07-18-2009 12:48 PM
Templates Built in Techdude7 Suggestions and Feature Requests 1 04-01-2009 04:28 PM
templates aroymart Questions and Supports 15 02-18-2009 01:46 PM


All times are GMT -5. The time now is 02:17 AM.

Currently Active Users: 9593 (0 members and 9593 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636