Next Page

1

Previous Page

Thread: Monthly Archives Pod

Created on: 09/06/09 08:43 PM

Replies: 9

Cliff


New Member


Joined: 09/05/09

Posts: 9

Monthly Archives Pod
09/06/09 8:43 PM

Does anyone have the SQL and output code to show archives by the month / year?
For instance:
2009
September (2)
August (4)
July (10)

It would only show the months with posts and have a link to that month. So if month had no posts it would simply skip it.

Thanks, Cliff

Link | Top | Bottom

Cliff


New Member


Joined: 09/05/09

Posts: 9

RE: Monthly Archives Pod
09/08/09 8:24 PM

Well, I found this post, but I do not how to output the data in the Pod, can I get some advice please?
http://www.coldfusionjedi.com/forums/messages.cfm?threadid=CBD21300-E365-3C00-3CF086069BB4C79E
Thanks, Cliff

Link | Top | Bottom

admin


Experienced Member


Joined: 04/08/04

Posts: 2,875

RE: Monthly Archives Pod
09/08/09 9:24 PM

You should be able to copy any of the other pods. They all use a simple pod custom tag for layout. Have you tried looking at the other pods?

Link | Top | Bottom

Cliff


New Member


Joined: 09/05/09

Posts: 9

RE: Monthly Archives Pod
09/09/09 1:16 PM

Hi,

I did, but not being a programmer, I really have no idea what I am looking for.

My test pod to display the years / months looks like this, but is blank when I view it. It just has the header of test.


<cfsetting enablecfoutputonly='true'>
<cfprocessingdirective pageencoding='utf-8'>
<!---
Name : test.cfm
Author : PodGenerator (based on archives.cfm by Raymond Camden)
--->

<cfmodule template='../../tags/podlayout.cfm' title='test'>
<!---
Your Pod text goes here -
Remember it has to be in cfoutput
tags or it will not be displayed
--->
<cfoutput>
<cffunction name="getEntryMonths" access="remote" returnType="query" output="false"> <cfset var getA = ""> <cfquery name="getA" datasource="#instance.dsn#"> select year(posted) as year, month(posted) as month, count(*) as entryCount from tblBlogEntries where blog = <cfqueryparam value="#instance.name#" cfsqltype="CF_SQL_VARCHAR" maxlength="50"> group by year(posted), month(posted) order by year(posted) DESC, month(posted) DESC </cfquery> <cfreturn getA> </cffunction>


</cfoutput>
</cfmodule>
<cfsetting enablecfoutputonly='false'/>
* Last updated by: Cliff on 9/10/2009 @ 1:58 PM *

Link | Top | Bottom

admin


Experienced Member


Joined: 04/08/04

Posts: 2,875

RE: Monthly Archives Pod
09/10/09 11:56 AM

Did you mispaste there? I see nothing in the cffunction. If you did have a full cffunction there, remember that a UDF (your function) by itself does nothing. You have to _call_ it.

view plain print about
1
2<cfoutput>#myUDF()#</cfoutput>

Secondly - remember that BlogCFC caches the display. During testing, you want to hit your site with ?reinit=1 in the URL.

Link | Top | Bottom

Cliff


New Member


Joined: 09/05/09

Posts: 9

RE: Monthly Archives Pod
09/10/09 2:03 PM

Sorry about it not showing, I pasted inside of the code tags, and for some reason it didn't show. I edited it to have it display now.
I don't have the pod active yet, I am trying to view it using the Show Sample Output link, so caching shouldn't be in issue correct?

Does it look like the cffunction / cfquery listed should work?
If yes, can you show how I would output it?
I tried <cfoutput>#getEntryMonths()#</cfoutput> and <cfoutput>#getEntryMonths#</cfoutput>, both gave errors.

Link | Top | Bottom

admin


Experienced Member


Joined: 04/08/04

Posts: 2,875

RE: Monthly Archives Pod
09/11/09 4:40 PM

getEntryMonths() (the one with the parans) should work. What error did you get?

Link | Top | Bottom

Cliff


New Member


Joined: 09/05/09

Posts: 9

RE: Monthly Archives Pod
09/11/09 7:21 PM

When I try just this, it shows the table header with test, and nothing listed below (I know I'm not outputting anything yet).
<cfsetting enablecfoutputonly='true'>
<cfprocessingdirective pageencoding='utf-8'>
<!---
Name : test.cfm
Author : PodGenerator (based on archives.cfm by Raymond Camden)
--->

<cfmodule template='../../tags/podlayout.cfm' title='test'>
<!---
Your Pod text goes here -
Remember it has to be in cfoutput
tags or it will not be displayed
--->
<cfoutput>
<cffunction name="getEntryMonths" access="remote" returnType="query" output="false"> <cfset var getA = ""> <cfquery name="getA" datasource="#instance.dsn#"> select year(posted) as year, month(posted) as month, count(*) as entryCount from tblBlogEntries where blog = <cfqueryparam value="#instance.name#" cfsqltype="CF_SQL_VARCHAR" maxlength="50"> group by year(posted), month(posted) order by year(posted) DESC, month(posted) DESC </cfquery> <cfreturn getA> </cffunction>
</cfoutput>

</cfmodule>
<cfsetting enablecfoutputonly='false'/>

Then I add this <cfoutput>#getEntryMonths()#</cfoutput> and get this error:
Element DSN is undefined in INSTANCE.

So I replaced the #instance.dsn# with the DSN and I get this:
Element NAME is undefined in INSTANCE.

That's where I gave up. :)

Link | Top | Bottom

admin


Experienced Member


Joined: 04/08/04

Posts: 2,875

RE: Monthly Archives Pod
09/14/09 4:16 PM

Sorry for the delay - long weekend. :) You can't use instant.dsn because that is available in the CFC only. Switch it to application.dsn and try again.

Link | Top | Bottom

mangalukas


New Member


Joined: 02/25/10

Posts: 1

Defense Devil manga online
02/25/10 11:00 PM

spam wipe. dofus alert.
* Last updated by: admin on 2/25/2010 @ 11:55 PM *

Link | Top | Bottom

Next Page

1

Previous Page

New Post

Please login to post a response.