3 of 13
3
Custom Fields in {exp:weblog:entries /}
Posted: 22 December 2006 09:58 AM   [ Ignore ]   [ # 37 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  420
Joined  10-10-2004

No, sorry, I didn’t. Cool, I will make sure to do that now. Thanks!!

===

Update: Yep - that did the trick!

Profile
 
 
Posted: 01 January 2007 02:57 PM   [ Ignore ]   [ # 38 ]  
Research Assistant
RankRankRank
Total Posts:  418
Joined  12-22-2003
Mark Huot - 07 November 2006 10:42 PM

The only condition is that you have to modify your ‘mod.weblog.php’ file to allow the extension hook.  You can find instructions for that in the top of the .php file.

Hi. I’m trying to get this extension to work. I’m encountering the same problem that Rob Q was encountering, and I’m 99% certain the reason is that I haven’t modified the mod.weblog.php file. But I can’t for the life of me find the instructions for doing that in the top of the .php file.

Can someone point me in the right direction?

Thanks,
Frank

Profile
 
 
Posted: 01 January 2007 03:39 PM   [ Ignore ]   [ # 39 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  420
Joined  10-10-2004

If you open the extension in an HTML editor it has this instruction for modifying the mod.weblog.php file which itself is found in System > Modules > mod.weblog.php.

So in mod.weblog.php search for

($this->paginate == TRUE)

—I believe there is more than one instance but it should be around line 2137

FIND THIS:
                
// ----------------------------------------
                //  Do we need pagination?
                // ----------------------------------------
                // We'll run the query to find out
                
if ($this->paginate == TRUE)
                
            
INSERT THIS RIGHT BEFORE THAT LINE:
                
// -------------------------------------------
                // 'build_sql_query' hook.
                //  - Rewrite, or add to the sql query
                //
                    
global $EXT;
                    if (isset(
$EXT->extensions['build_sql_query']))
                    
{
                        $sql
= $EXT->call_extension('build_sql_query', $sql, $this);
                        if (
$EXT->end_script === TRUE) return;
                    
}
                
//
                // -------------------------------------------

Profile
 
 
Posted: 01 January 2007 03:54 PM   [ Ignore ]   [ # 40 ]  
Research Assistant
RankRankRank
Total Posts:  418
Joined  12-22-2003

Okay. I see now. That did the trick.

Thanks Rob Q, for the speedy answer (and on New Year’s Day - didn’t expect such a quick response)!

Frank

Profile
 
 
Posted: 09 January 2007 09:48 AM   [ Ignore ]   [ # 41 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  203
Joined  02-10-2006

Mark -

What a great extension - especially for those of us with little query knowledge. Thank you!!

I just ran into a situation where I need to include two different conditions like this:

{exp:weblog:entries weblog="events" show_future_entries="yes" limit="3" sort="asc" efront="=Yes" esloc="Delaware|Virginia"}
<h2>title</h2>
{body}
{
/exp:weblog:entries}

But as I quickly found out - it does not work.

Can I have two conditions (notice the last two conditions: efront and esloc), but then look closer at esloc - I tried to include two different settings. Is this possible? If not I would love to add this as a feature request.

Profile
 
 
Posted: 11 January 2007 11:43 AM   [ Ignore ]   [ # 42 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  962
Joined  12-20-2002

Mark, Thanks so much for taking up the Extensions challenge and bringing us functionality we long for such as in this extension. Count me as another grateful user of your work.

Must. Study. Extensions.

 Signature 

Who ain’t a slave? - Ishmael

Profile
 
 
Posted: 11 January 2007 12:23 PM   [ Ignore ]   [ # 43 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1505
Joined  05-15-2004

I am a little uncertain about which version is the most recent of this extension. This thread lists 2.0.4, but Mark’s website lists it as 2.1.2. smile

 Signature 


:: Westeros :: Hippoi Athanatoi ::

Blackadder: “Baldrick, have you no idea what irony is?”   
Baldrick: “Yeah! It’s like goldy and bronzy, only it’s made of iron.”
Blackadder III, Amy and Amiability

Profile
 
 
Posted: 12 January 2007 10:18 AM   [ Ignore ]   [ # 44 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  962
Joined  12-20-2002

Any chance of getting this to work with relationship fields?

 Signature 

Who ain’t a slave? - Ishmael

Profile
 
 
Posted: 21 January 2007 11:17 AM   [ Ignore ]   [ # 45 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  203
Joined  02-10-2006
bjsteiger - 09 January 2007 09:48 AM

Mark -

What a great extension - especially for those of us with little query knowledge. Thank you!!

I just ran into a situation where I need to include two different conditions like this:

{exp:weblog:entries weblog="events" show_future_entries="yes" limit="3" sort="asc" efront="=Yes" esloc="Delaware|Virginia"}
<h2>title</h2>
{body}
{
/exp:weblog:entries}

But as I quickly found out - it does not work.

Can I have two conditions (notice the last two conditions: efront and esloc), but then look closer at esloc - I tried to include two different settings. Is this possible? If not I would love to add this as a feature request.

bump

Profile
 
 
Posted: 21 January 2007 11:36 AM   [ Ignore ]   [ # 46 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

ok try the latest version, it should work with multiple conditions, however it will combine them with an AND so you will get entries with efront=“yes” AND esloc=“delaware|virginia”.  of course if you wanted to do delaware OR virginia you could use a “sql” attribute like so, to basically create a custom query

{exp:weblog:entries weblog="events" show_future_entries="yes" limit="3" sort="asc" efront="=Yes" sql1="(" esloc="Delaware OR Virginia" sql2=")"}

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 26 January 2007 07:12 AM   [ Ignore ]   [ # 47 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  242
Joined  05-24-2002

First of all: thank you so much for creating this Extension. It seems to work great.
But is it possible that it’s not working with url segments?

I’m trying something like this:

{exp:weblog:entries weblog="events" orderby="title" sort="asc" disable="categories|pagination|trackbacks" genre="{segment_4}"}

And of course Genre is my custom field where authors can select from Metal to Classic.
If this is not working with your extension I have two questions:
- What can be done to make it work?
- If there’s nothing that can be done about it, am I correct that the only way to program this is to have a huge list of conditional variable where I have to code each “genre” as a seperate possible query?
- Or is there a clever MySQL query that could help me out?

ONce again, thank you very much!!

 Signature 

You know me better than that, love. I don’t “do” anything. Things just happen.

Profile
 
 
Posted: 30 January 2007 10:53 AM   [ Ignore ]   [ # 48 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  774
Joined  07-18-2006

I can’t seem to get this to work.  I’ve made the changes to mod.weblog.php as listed but it still doesn’t seem to work.  Here’s my code:

{exp:weblog:entries weblog="member_job_listings" disable="categories|member_data|trackbacks" orderby="job_application_deadline" sort="asc" paginate="bottom" job_application_deadline="=3"}

job_application_deadline is the custom field.  Right now I’m checking to see if it is ‘3’ - it’s a timestamp field so that shouldn’t return any results, but they all show.  I’ve messed around with parameter order, as well as removing all the other parameters and still no go.

Any ideas?

EDIT: I’m an idiot. I hadn’t enabled the extension - it’s working great.

Thanks again Mark for your tireless efforts to extend EE!

Profile
 
 
Posted: 30 January 2007 03:56 PM   [ Ignore ]   [ # 49 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  774
Joined  07-18-2006

This extension doesn’t seem to work if you’re selecting a random entry.  What I would like to happen is select a random entry from those with a certain field filled - so it only chooses from the entries with information in that field.

Here’s my code:

{exp:weblog:entries weblog="member_spotlight" limit="1" orderby="random" disable="categories|pagination|member_data|trackbacks|custom_fields" member_spotlight_masthead="/.+/"}

Any way to fix this?

Profile
 
 
Posted: 31 January 2007 06:25 PM   [ Ignore ]   [ # 50 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1505
Joined  05-15-2004

Is it possible to match a partial pattern? For example, could you get it to display entries where the specific custom field is 2.1, 2.1.1, 2.1.2 and 2.1.2.1 by matching on 2.1*? Or could the greater than option handle that sort of progression too?

 Signature 


:: Westeros :: Hippoi Athanatoi ::

Blackadder: “Baldrick, have you no idea what irony is?”   
Baldrick: “Yeah! It’s like goldy and bronzy, only it’s made of iron.”
Blackadder III, Amy and Amiability

Profile
 
 
Posted: 06 February 2007 07:31 AM   [ Ignore ]   [ # 51 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Linda, it should work, however, you would want to use the SQL syntax like so: field_name=‘2.1%’.  I believe that would do it.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 06 February 2007 07:35 AM   [ Ignore ]   [ # 52 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

The Pie Man, it won’t work when selecting a random entry because EE picks the random entry before my code executes.  I’m not too sure what can be done about this.  In your specific case it may be easier to just use a full-blown {exp:query sql=”“} tag.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 06 February 2007 09:56 AM   [ Ignore ]   [ # 53 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1505
Joined  05-15-2004

Linda, it should work, however, you would want to use the SQL syntax like so: field_name=’2.1%.  I believe that would do it.

Should it still work if it needs to fetch the number from a segment? I tried ‘{exp:weblog:entries weblog=”{current_weblog}” 32_number_display=”{segment_3}%”}’ and that doesn’t seem to work.

Edited to add: Tested by adding the number straight in there too, but that doesn’t seem to work either. I did do the modifications to get the hooks in, but its possible I did something wrong there.

 Signature 


:: Westeros :: Hippoi Athanatoi ::

Blackadder: “Baldrick, have you no idea what irony is?”   
Baldrick: “Yeah! It’s like goldy and bronzy, only it’s made of iron.”
Blackadder III, Amy and Amiability

Profile
 
 
Posted: 07 February 2007 10:18 AM   [ Ignore ]   [ # 54 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1505
Joined  05-15-2004

I took another look at the modifications needed for the hook, and the bit I am unsure about is the first one. It says to find the section ‘Do we need pagination?’ and to insert the code snipper right before that line. I am not sure if that means right before ‘Do we need pagination?’ or right before ‘if ($this->paginate == TRUE)’?

 Signature 


:: Westeros :: Hippoi Athanatoi ::

Blackadder: “Baldrick, have you no idea what irony is?”   
Baldrick: “Yeah! It’s like goldy and bronzy, only it’s made of iron.”
Blackadder III, Amy and Amiability

Profile
 
 
   
3 of 13
3
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64553 Total Logged-in Users: 28
Total Topics: 81156 Total Anonymous Users: 15
Total Replies: 436586 Total Guests: 197
Total Posts: 517742    
Members ( View Memberlist )