Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Need help putting code into .tpl file - php rss2

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-15-2008, 08:47 AM
  Madhatterr's Avatar 
Madhatterr Madhatterr is offline
 

eXpert
  
Join Date: Jan 2007
Posts: 202
 

Talking Need help putting code into .tpl file - php rss2

Okay,

I've seen RSS discussions before (there are mods for sale out there) but I thought I might try to do some tweeking myself based off some code another person wrote. I think I've got a pretty hot idea that could work but I'm missing one or two small details that I hope you guys can help me with.

Please take a look at: http://madhatterrgames.com/rss2html.php?XMLFILE=http://madhatterrgames.com/phpBB3/generate_feed.php%3fcont...tml&MAXITEMS=1

That's what the feed will look like at the top of my center/right area on this page (and, because of where I'm putting it in the home.tpl file, all my pages) http://www.madhatterrgames.com/home.php ... on the home.php page it would appear just above the category images.

The code I'd like to put into the home.tpl would look something like this (I think):

Code:
<?php $XMLFILE = "http://madhatterrgames.com/phpBB3/generate_feed.php?content=posts&f%5B%5D=17&number_items=1&sid=3043e6c2e27b05430edc3ddff7d95c4b"; $TEMPLATE = "http://madhatterrgames.com/sample-template.html"; $MAXITEMS = "1"; include("rss2html.php"); ?>

or

Code:
<?php include("http://madhatterrgames.com/rss2html.php?XMLFILE=http://madhatterrgames.com/phpBB3/generate_feed.php%3fcontent%3dposts%26f%255B%255D%3d17%26number_items%3d1%26sid%3d3043e6c2e27b05430edc3ddff7d95c4b&TEMPLATE=http://madhatterrgames.com/sample-template.html&MAXITEMS=1"); ?>

Initially I tried putting the first in without the <?php tag and the ?> end tag. No dice. Second I tried the same with the second and then with putting { } around hte include command making sure to try it with a space before and after the include command.

All three attempts failed and produced errors. I'm pretty sure I should be able to make this appear in the home.tpl ... I'm just failing in the execution of it. LOL

Could someone please give me a hand with this one. I promise eternal gratitude and cookies if we ever meet face to face. *wink*

-Dee
__________________
DeAnna Ross
http://madhatterrgames.com [v.4.1.8] Fashion Template
http://www.hortonstores.com [v.4.1.12] Fashion Mosaic Skin
http://teststore.hortonstores.com [v.4.2.2] Fashion Mosaic Skin TEST STORE - NOT FOR ACTUAL SHOPPING!
Reply With Quote
  #2  
Old 09-18-2008, 07:42 AM
  Madhatterr's Avatar 
Madhatterr Madhatterr is offline
 

eXpert
  
Join Date: Jan 2007
Posts: 202
 

Default Re: Need help putting code into .tpl file - php rss2

*polite bump*
__________________
DeAnna Ross
http://madhatterrgames.com [v.4.1.8] Fashion Template
http://www.hortonstores.com [v.4.1.12] Fashion Mosaic Skin
http://teststore.hortonstores.com [v.4.2.2] Fashion Mosaic Skin TEST STORE - NOT FOR ACTUAL SHOPPING!
Reply With Quote
  #3  
Old 09-18-2008, 08:08 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Need help putting code into .tpl file - php rss2

Smarty was designed to divide HTML markup and PHP script. So it is not convinient to put PHP scripts into template.
But it is possible
Wrap the PHP code with tags

HTML Code:
{php} PUT script here {/php}
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #4  
Old 09-18-2008, 08:24 AM
  Madhatterr's Avatar 
Madhatterr Madhatterr is offline
 

eXpert
  
Join Date: Jan 2007
Posts: 202
 

Default Re: Need help putting code into .tpl file - php rss2

So it should look like this?

Code:
{php} <?php $XMLFILE = "http://madhatterrgames.com/phpBB3/generate_feed.php?content=posts&f%5B%5D=17&number_items=1&sid=3043e6c2e27b05430edc3ddff7d95c4b"; $TEMPLATE = "http://madhatterrgames.com/sample-template.html"; $MAXITEMS = "1"; include("http://madhatterrgames.com/rss2html.php"); ?> {/php}
__________________
DeAnna Ross
http://madhatterrgames.com [v.4.1.8] Fashion Template
http://www.hortonstores.com [v.4.1.12] Fashion Mosaic Skin
http://teststore.hortonstores.com [v.4.2.2] Fashion Mosaic Skin TEST STORE - NOT FOR ACTUAL SHOPPING!
Reply With Quote
  #5  
Old 09-18-2008, 08:33 AM
  Madhatterr's Avatar 
Madhatterr Madhatterr is offline
 

eXpert
  
Join Date: Jan 2007
Posts: 202
 

Default Re: Need help putting code into .tpl file - php rss2

Okay I'm fiddling still (thanks btw for replying!) here's what I've gotten so far in trial and error.


When I put it in like this

Code:
{php} <?php $XMLFILE = "http://madhatterrgames.com/phpBB3/generate_feed.php?content=posts&f%5B%5D=17&number_items=1&sid=3043e6c2e27b05430edc3ddff7d95c4b"; $TEMPLATE = "http://madhatterrgames.com/sample-template.html"; $MAXITEMS = "1"; include("http://madhatterrgames.com/rss2html.php"); ?> {/php}

I get this:

Parse error: syntax error, unexpected '<' in /.../public_html/var/templates_c/%%5A^5A2^5A22702C%%home.tpl.php on line 206



When I put it in like this:
Code:
{php} $XMLFILE = "http://madhatterrgames.com/phpBB3/generate_feed.php?content=posts&f%5B%5D=17&number_items=1&sid=3043e6c2e27b05430edc3ddff7d95c4b"; $TEMPLATE = "http://madhatterrgames.com/sample-template.html"; $MAXITEMS = "1"; include("http://madhatterrgames.com/rss2html.php"); {/php}


I get this:

Parse error: syntax error, unexpected '<' in /.../public_html/var/templates_c/%%5A^5A2^5A22702C%%home.tpl.php on line 206



When I put it in like this:
Code:
{php} <?php include("http://madhatterrgames.com/rss2html.php?XMLFILE=http://madhatterrgames.com/phpBB3/generate_feed.php%3fcontent%3dposts%26f%255B%255D%3d17%26number_items%3d1%26sid%3d3043e6c2e27b05430edc3ddff7d95c4b&TEMPLATE=http://madhatterrgames.com/sample-template.html&MAXITEMS=1"); ?> {/php}


I get this:

Parse error: syntax error, unexpected '<' in /.../public_html/var/templates_c/%%5A^5A2^5A22702C%%home.tpl.php on line 206



When I put it in like this:
Code:
{php} include("http://madhatterrgames.com/rss2html.php?XMLFILE=http://madhatterrgames.com/phpBB3/generate_feed.php%3fcontent%3dposts%26f%255B%255D%3d17%26number_items%3d1%26sid%3d3043e6c2e27b05430edc3ddff7d95c4b&TEMPLATE=http://madhatterrgames.com/sample-template.html&MAXITEMS=1"); {/php}

I get this:
Warning: include() [function.include]: URL file-access is disabled in the server configuration in /.../public_html/var/templates_c/%%5A^5A2^5A22702C%%home.tpl.php on line 206
__________________
DeAnna Ross
http://madhatterrgames.com [v.4.1.8] Fashion Template
http://www.hortonstores.com [v.4.1.12] Fashion Mosaic Skin
http://teststore.hortonstores.com [v.4.2.2] Fashion Mosaic Skin TEST STORE - NOT FOR ACTUAL SHOPPING!
Reply With Quote
  #6  
Old 09-19-2008, 12:47 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Need help putting code into .tpl file - php rss2

HTML Code:
{php} include("http://madhatterrgames.com/rss2html.php?XMLFILE=http://madhatterrgames.com/phpBB3/generate_feed.php%3fcontent%3dposts%26f%255B%255D%3d17%26number_items%3d1%26sid%3d3043e6c2e27b05430edc3ddff7d95c4b&TEMPLATE=http://madhatterrgames.com/sample-template.html&MAXITEMS=1"); {/php}


should not work due to security reasons
You have to specify not the URL of the file, but path to it from the directory where your store is located

Cleanup templates cache with
HTML Code:
http://madhatterrgames.com/pathToYourStore/cleanup.php
in your browser before proceed and try
HTML Code:
{php} include("rss2html.php?XMLFILE=/phpBB3/generate_feed.php%3fcontent%3dposts%26f%255B%255D%3d17%26number_items%3d1%26sid%3d3043e6c2e27b05430edc3ddff7d95c4b&TEMPLATE=sample-template.html&MAXITEMS=1"); {/php}

if rss2html.php is located in the folder with your store.
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #7  
Old 09-20-2008, 06:19 AM
  Madhatterr's Avatar 
Madhatterr Madhatterr is offline
 

eXpert
  
Join Date: Jan 2007
Posts: 202
 

Default Re: Need help putting code into .tpl file - php rss2

Thank You SOOO MUCH for taking your time to help me out with this.
I did as you instructed and got the following error:

Quote:
Warning: include(rss2html.php?XMLFILE=/phpBB3/generate_feed.php%3fcontent%3dposts%26f%255B%255D% 3d17%26number_items%3d1%26sid%3d3043e6c2e27b05430e dc3ddff7d95c4b&TEMPLATE=sample-template.html&MAXITEMS=1) [function.include on line ]: failed to open stream: No such file or directory in /{pathtomystore}/templates_c/%%5A^5A2^5A22702C%%home.tpl.php206

Any other help you can give is greatly appriciated.

-Dee
__________________
DeAnna Ross
http://madhatterrgames.com [v.4.1.8] Fashion Template
http://www.hortonstores.com [v.4.1.12] Fashion Mosaic Skin
http://teststore.hortonstores.com [v.4.2.2] Fashion Mosaic Skin TEST STORE - NOT FOR ACTUAL SHOPPING!
Reply With Quote
  #8  
Old 09-21-2008, 11:49 PM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: Need help putting code into .tpl file - php rss2

it's like poking all around without access to your server

One more try:
Place rss2html.php in the root of your webserver and the add just one more slash:
HTML Code:
{php} include("/rss2html.php?XMLFILE=/phpBB3/generate_feed.php%3fcontent%3dposts%26f%255B%255D%3d17%26number_items%3d1%26sid%3d3043e6c2e27b05430edc3ddff7d95c4b&TEMPLATE=sample-template.html&MAXITEMS=1"); {/php}
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #9  
Old 09-22-2008, 07:21 AM
  Madhatterr's Avatar 
Madhatterr Madhatterr is offline
 

eXpert
  
Join Date: Jan 2007
Posts: 202
 

Default Re: Need help putting code into .tpl file - php rss2

LOL, the things we go through for better seo and content.

Alright, tried the above and got this error:

Quote:
Warning: include(/rss2html.php?XMLFILE=/phpBB3/generate_feed.php%3fcontent%3dposts%26f%255B%255D% 3d17%26number_items%3d1%26sid%3d3043e6c2e27b05430e dc3ddff7d95c4b&TEMPLATE=sample-template.html&MAXITEMS=1) [function.include]: failed to open stream: No such file or directory in /home/hortonst/public_html/var/templates_c/%%5A^5A2^5A22702C%%home.tpl.php on line 207

As for your mention of access to our website, any chance you'd be willing to nose around? If so I'd be willing to drop you the information, it might be quicker than this guess work based off my replies (since you seem willing to assist us until we get it right ... did I mention how VERY much I appriciate this?)

Anyway, even if you're not willing... thanks and hopefully we'll get this figured out soon. I'm sure it will be a ton better for our site than the iframe solution I'm using right now.

-Dee
__________________
DeAnna Ross
http://madhatterrgames.com [v.4.1.8] Fashion Template
http://www.hortonstores.com [v.4.1.12] Fashion Mosaic Skin
http://teststore.hortonstores.com [v.4.2.2] Fashion Mosaic Skin TEST STORE - NOT FOR ACTUAL SHOPPING!
Reply With Quote
  #10  
Old 09-22-2008, 08:04 AM
  Madhatterr's Avatar 
Madhatterr Madhatterr is offline
 

eXpert
  
Join Date: Jan 2007
Posts: 202
 

Talking Re: Need help putting code into .tpl file - php rss2

For those looking to put an rss feed reader on their page, here's a GREAT & FREE solution: http://www.xcartmods.co.uk/x-cart-rss-feeds-displayer-v4x-x-cart-mods-pr-17.html

Victor, thanks ever so much for your help but it seems someone beat me to the answer on how to do it! If I do any successful tinkering with it, I'll post here and share.

YAY!!!

-Dee
__________________
DeAnna Ross
http://madhatterrgames.com [v.4.1.8] Fashion Template
http://www.hortonstores.com [v.4.1.12] Fashion Mosaic Skin
http://teststore.hortonstores.com [v.4.2.2] Fashion Mosaic Skin TEST STORE - NOT FOR ACTUAL SHOPPING!
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:49 AM.

   

 
X-Cart forums © 2001-2020