|   |   |   | ||||
| 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. | 
|    | 
| 
 | |||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. | 
|  | Thread Tools | 
|  08-24-2011, 02:36 PM | #1 | 
| Confirmed User Industry Role:  Join Date: Aug 2002 Location: USA 
					Posts: 6,721
				 | 
				
				PHP Question
			 I'm trying to use some code I found to add numbers next to post titles in wordpress. I'm getting a unexpected t string error when using it. Any idea what the problem is? Code: <?php if ( $paged < 2 ) {
$my_paged = 0;
} else {
$my_paged = ($paged ? 1) * get_option(?posts_per_page?);         <---this is the line thats causing the error it says.
}
$count = 1;
?>
				__________________ icq 156131086 | 
|   |           | 
|  08-24-2011, 02:39 PM | #2 | 
| Industry Role:  Join Date: Aug 2006 Location: Little Vienna 
					Posts: 32,235
				 | Maybe you puted code to wrong wordpress file ? | 
|   |           | 
|  08-24-2011, 02:41 PM | #3 | 
| Too lazy to set a custom title Join Date: Jan 2002 Location: Holland 
					Posts: 9,870
				 | is get_option(‘posts_per_page’) defined? 
				__________________ Don't let greediness blur your vision | You gotta let some shit slide icq - 441-456-888 | 
|   |           | 
|  08-24-2011, 02:46 PM | #4 | 
| Confirmed User Industry Role:  Join Date: Aug 2002 Location: USA 
					Posts: 6,721
				 | Hell if I know. These are the instructions I followed. http://blog.dembowski.net/2007/08/02/numbered-titles/ 
				__________________ icq 156131086 | 
|   |           | 
|  08-24-2011, 02:47 PM | #5 | 
| Confirmed User Industry Role:  Join Date: Jul 2001 Location: 127.0.0.1 
					Posts: 9,266
				 | try replacing this Code: $my_paged = ($paged ? 1) * get_option(?posts_per_page?); <---this is the line thats Code: $my_paged = ($paged ? 1) * get_option('posts_per_page');         <---this is the line thats
				__________________ This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth | 
|   |           | 
|  08-24-2011, 03:18 PM | #6 | 
| <&(©¿©)&> Industry Role:  Join Date: Jul 2002 Location: Chicago 
					Posts: 47,882
				 | wrong quotes, use single quotes -> ' 
				__________________ Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000 Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager  Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager | 
|   |           | 
|  08-24-2011, 03:23 PM | #7 | 
| Confirmed User Industry Role:  Join Date: Aug 2002 Location: USA 
					Posts: 6,721
				 | I'm still getting the same error on the same line. 
				__________________ icq 156131086 | 
|   |           | 
|  08-24-2011, 03:25 PM | #8 | 
| Beer Money Baron Industry Role:  Join Date: Jan 2001 Location: brujah / gmail 
					Posts: 22,157
				 | Please don't listen to harvey, pete or woj.  What you need here is to replace the ` backtick with a single quote character. lol 
				__________________ 
 | 
|   |           | 
|  08-24-2011, 03:26 PM | #9 | |
| <&(©¿©)&> Industry Role:  Join Date: Jul 2002 Location: Chicago 
					Posts: 47,882
				 | Quote: 
    
				__________________ Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000 Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager  Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager | |
|   |           | 
|  08-24-2011, 03:31 PM | #10 | 
| Beer Money Baron Industry Role:  Join Date: Jan 2001 Location: brujah / gmail 
					Posts: 22,157
				 | It must be something else then.  Try:   get_option( "posts_per_page" ) just to compare 
				__________________ 
 | 
|   |           | 
|  08-24-2011, 03:43 PM | #11 | 
| Damn Right I Kiss Ass! Industry Role:  Join Date: Dec 2003 Location: Cowtown, USA 
					Posts: 32,422
				 | Aldo 0 * something can generate an error... | 
|   |           | 
|  08-24-2011, 04:05 PM | #12 | 
| Confirmed User Industry Role:  Join Date: Aug 2002 Location: USA 
					Posts: 6,721
				 | Nothing seems to work   
				__________________ icq 156131086 | 
|   |           | 
|  08-24-2011, 04:07 PM | #13 | 
| Beer Money Baron Industry Role:  Join Date: Jan 2001 Location: brujah / gmail 
					Posts: 22,157
				 | It's probably something else.  Paste the lines before and after that, and or the exact error message. 
				__________________ 
 | 
|   |           | 
|  08-24-2011, 04:26 PM | #14 | 
| Confirmed User Industry Role:  Join Date: Aug 2002 Location: USA 
					Posts: 6,721
				 | I've moved it around which doesn't seem to help either. Parse error: syntax error, unexpected T_STRING in *****/index.php on line 43 Code: <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $key="featured_external"; $custom = get_post_meta($post->ID, $key, true); ?>
<?php if ( $paged < 2 ) {
$my_paged = 0;
} else {
$my_paged = ($paged ? 1) * get_option('posts_per_page');
}
$count = 1;
?>
<div class="site clearfix" id="rgmevlsotukficza6158">
<a href="<?php $key="featured_external"; echo get_post_meta($post->ID, $key, true); ?>"title="<?php the_title(); ?>">
<?php if ( has_post_thumbnail()) the_post_thumbnail('featured-thumb', array('class' => 'thumb')); ?>
</a>
<a target="_blank" href="http://www.link-paysite.com" class="join-link">Visit Paysite # 01 NOW !</a>
<h1><?php echo $my_paged + $count . ?. ?; ?> <a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
<p><?php the_content(''); ?></p>
<a target="_blank" href="http://www.link.com" class="tour" id="ukplowdzgxbhtncyeqf7410">Free Preview</a>
<p class="clear"></p>
</div>
<?php $count = $count + 1; ?>
<?php endwhile; endif; ?>
				__________________ icq 156131086 | 
|   |           | 
|  08-24-2011, 04:36 PM | #15 | |
| Confirmed User Industry Role:  Join Date: Jul 2001 Location: 127.0.0.1 
					Posts: 9,266
				 | Quote: 
  
				__________________ This post is endorsed by CIA, KGB, MI6, the Mafia, Illuminati, Kim Jong Il, Worldwide Ninjas Association, Klingon Empire and lolcats. Don't mess around with it, just accept it and embrace the truth | |
|   |           | 
|  08-24-2011, 04:40 PM | #16 | 
| Beer Money Baron Industry Role:  Join Date: Jan 2001 Location: brujah / gmail 
					Posts: 22,157
				 | The minus character is not a minus character in this: ($paged – 1) Fix that and you should be good. 
				__________________ 
 | 
|   |           | 
|  08-24-2011, 04:41 PM | #17 | |
| Beer Money Baron Industry Role:  Join Date: Jan 2001 Location: brujah / gmail 
					Posts: 22,157
				 | Quote: 
 
				__________________ 
 | |
|   |           | 
|  08-24-2011, 04:49 PM | #18 | |
| Confirmed User Industry Role:  Join Date: Aug 2002 Location: USA 
					Posts: 6,721
				 | Quote: 
 That removed the error but fuckin a now it just shows the number 1 next to every post. This is annoying  
				__________________ icq 156131086 | |
|   |           | 
|  08-24-2011, 04:55 PM | #19 | |
| Beer Money Baron Industry Role:  Join Date: Jan 2001 Location: brujah / gmail 
					Posts: 22,157
				 | Quote: 
 change $count = 1; to this if ( ! isset( $count ) ) $count = 1; 
				__________________ 
 | |
|   |           | 
|  08-24-2011, 04:58 PM | #20 | 
| Confirmed User Industry Role:  Join Date: Aug 2002 Location: USA 
					Posts: 6,721
				 | Alright I just pulled it back out of the loop and it's working right now. Thanks for all the help guys! 
				__________________ icq 156131086 | 
|   |           | 
|  08-24-2011, 05:02 PM | #21 | 
| Beer Money Baron Industry Role:  Join Date: Jan 2001 Location: brujah / gmail 
					Posts: 22,157
				 | when you see code on a blog like that http://blog.dembowski.net/2007/08/02/numbered-titles/ Mouseover the code snippet, and look at the icons. mouseover each of those and select either the view source, or copy to clipboard. That'd fix the errors introduced by trying to copy/paste the code from the blog formatting. 
				__________________ 
 | 
|   |           | 
|  08-24-2011, 05:24 PM | #22 | 
| Confirmed User Industry Role:  Join Date: Aug 2002 Location: USA 
					Posts: 6,721
				 | Alright thanks. 
				__________________ icq 156131086 | 
|   |           | 
|  08-24-2011, 05:43 PM | #24 | 
| Confirmed User Industry Role:  Join Date: Aug 2002 Location: USA 
					Posts: 6,721
				 | It's from a template I'm changing to a wordpress theme. I haven't edited the html yet. I know there's a bunch of unneeded crap in there. As far as the php goes...I'm not a programmer but it works. 
				__________________ icq 156131086 | 
|   |           |