Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 08-01-2012, 09:41 AM   #1
The Dawg
Confirmed User
 
The Dawg's Avatar
 
Join Date: Apr 2002
Location: State Of Bliss
Posts: 2,438
Wordpress: unexpected T_STRING error

I have a custom field named galleries that is producing the "Parse error: syntax error, unexpected T_STRING" error.

galleries field has the server location of a gallery ( /home/www/gallery1.php )


If I hardcode the link in the template it works
Code:
<?php include('/home/www/gallery1.php'); ?>
But...

Code:
<?php include('<?php echo get_post_meta($post->ID, 'galleries', true) ?>'); ?>
^^ ERROR ^^

Whats wrong with this line?

The Dawg is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-01-2012, 10:06 AM   #2
alcstrategy
Confirmed User
 
Industry Role:
Join Date: May 2012
Posts: 124
Code:
<?php include('<?php echo get_post_meta($post->ID, 'galleries', true) ?>'); ?>
That code is incorrect in a few ways.

The immediate reason you get T_STRING error is because you have single quotes within single quotes.

Also the use of include is incorrect and unnecessary..

Just do <?php echo get_post_meta($post->ID, 'galleries', true); ?>
alcstrategy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-01-2012, 10:18 AM   #3
The Dawg
Confirmed User
 
The Dawg's Avatar
 
Join Date: Apr 2002
Location: State Of Bliss
Posts: 2,438
Quote:
Originally Posted by alcstrategy View Post
Code:
<?php include('<?php echo get_post_meta($post->ID, 'galleries', true) ?>'); ?>
That code is incorrect in a few ways.

The immediate reason you get T_STRING error is because you have single quotes within single quotes.

Also the use of include is incorrect and unnecessary..

Just do <?php echo get_post_meta($post->ID, 'galleries', true); ?>
Thanks, I didnt notice the single quote issue.

If I use just the <?php echo get_post_meta($post->ID, 'galleries', true); ?>

it just prints out the location of the gallery /home/www/gallery1.php

What I'm trying to do is include a html page within the template.
The Dawg is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-01-2012, 10:31 AM   #4
The Dawg
Confirmed User
 
The Dawg's Avatar
 
Join Date: Apr 2002
Location: State Of Bliss
Posts: 2,438
If figured it out.

I set the custom field as a variable, then used that var in the include.
The Dawg is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-01-2012, 10:49 AM   #5
Zoxxa
Confirmed User
 
Zoxxa's Avatar
 
Industry Role:
Join Date: Feb 2011
Location: Ontario, Canada
Posts: 1,026
<?php include(get_post_meta($post->ID, 'galleries', true)); ?>

Thats probably what you wanted if the path is correct.
__________________
[email protected]
ICQ: 269486444
ZoxEmbedTube - Build unlimited "fake" tubes with this easy 100% unencoded CMS!
Zoxxa is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-01-2012, 11:15 AM   #6
The Dawg
Confirmed User
 
The Dawg's Avatar
 
Join Date: Apr 2002
Location: State Of Bliss
Posts: 2,438
Quote:
Originally Posted by Zoxxa View Post
<?php include(get_post_meta($post->ID, 'galleries', true)); ?>

Thats probably what you wanted if the path is correct.
Yeap. That works too.

Thanks!
The Dawg is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-01-2012, 12:13 PM   #7
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,220
ya you had a <?php inside a <?php ;)
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-01-2012, 12:52 PM   #8
alcstrategy
Confirmed User
 
Industry Role:
Join Date: May 2012
Posts: 124
Quote:
Originally Posted by The Dawg View Post
I have a custom field named galleries that is producing the "Parse error: syntax error, unexpected T_STRING" error.

galleries field has the server location of a gallery ( /home/www/gallery1.php )


If I hardcode the link in the template it works
Code:
<?php include('/home/www/gallery1.php'); ?>
But...

Code:
<?php include('<?php echo get_post_meta($post->ID, 'galleries', true) ?>'); ?>
^^ ERROR ^^

Whats wrong with this line?

sorry i totally overlooked what you were actually doing and just focused on the code i saw, my apologies
alcstrategy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 08-01-2012, 01:38 PM   #9
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,391
this thread delivers
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.