Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Can someone help me understand this?
Old 07-18-2011, 09:00 PM Can someone help me understand this?
NoeG's Avatar
Experienced Talker

Posts: 45
Name: Noe Garcia
Location: The great state of TEXAS we'll kick yer ***!
Trades: 0
Its a wordpress question, I'm trying to figure out what this is..
PHP Code:
      <?php
        $tmp_query 
$wp_query;
        
query_posts('showposts=3&cat=' get_cat_ID(dp_settings('featured')));
        
        if (
have_posts()) :
        
        while (
have_posts()) : the_post(); 
        
?>
particularly
PHP Code:
 $tmp_query $wp_query
could someone tell me what it is and what its for?
__________________

Please login or register to view this content. Registration is FREE
|personal portfolio and blog
NoeG is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-18-2011, 09:08 PM Re: Can someone help me understand this?
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
That line is making a copy of the old query. $wp_query will be overwritten by the call to query_posts.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 07-18-2011, 09:20 PM Re: Can someone help me understand this?
NoeG's Avatar
Experienced Talker

Posts: 45
Name: Noe Garcia
Location: The great state of TEXAS we'll kick yer ***!
Trades: 0
so what would be an example of that happening?
thank you for the quick reply
__________________

Please login or register to view this content. Registration is FREE
|personal portfolio and blog
NoeG is offline
Reply With Quote
View Public Profile
 
Old 07-18-2011, 09:24 PM Re: Can someone help me understand this?
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
By calling query_posts you are creating a new query. You can restore the query after you are done with the new query like so:
PHP Code:
$wp_query $tmp_query
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 07-18-2011, 09:28 PM Re: Can someone help me understand this?
NoeG's Avatar
Experienced Talker

Posts: 45
Name: Noe Garcia
Location: The great state of TEXAS we'll kick yer ***!
Trades: 0
oh so tmp is like temporary?
__________________

Please login or register to view this content. Registration is FREE
|personal portfolio and blog
NoeG is offline
Reply With Quote
View Public Profile
 
Old 07-18-2011, 09:35 PM Re: Can someone help me understand this?
NoeG's Avatar
Experienced Talker

Posts: 45
Name: Noe Garcia
Location: The great state of TEXAS we'll kick yer ***!
Trades: 0
Oh Ok yea I see what you mean now

PHP Code:
    <?php
    $wp_query 
$tmp_query;
    if (
have_posts()) :
    while (
have_posts()) : the_post(); 
    
?>
This one started another loop and like you said it changed it back

thank you for helping me
__________________

Please login or register to view this content. Registration is FREE
|personal portfolio and blog
NoeG is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Can someone help me understand this?
 

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32059 seconds with 12 queries