• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

include template with link

I'm trying to clear the cache in an admin area via a link on a page. My link right now is
<cfoutput><a href="members/act_clearcached.cfm">Clear Cache</a></cfoutput>

I don't really wqant to go to the page. I want it to include the template act_clearcached.cfm when it reloads.

what is missing here?
0
Shawn
Asked:
Shawn
  • 3
  • 2
1 Solution
 
_agx_Commented:
Assuming the template generates no output, cfinclude it:

<cfinclude template="act_clearcached.cfm">  
0
 
_agx_Commented:
Correction:

<cfinclude template="members/act_clearcached.cfm">
0
 
ShawnAuthor Commented:
but I want it to happen only when the link is clicked on. Would it be something like

<cfoutput><a href="<cfinclude template="members/act_clearcached.cfm"> ">Clear Cache</a></cfoutput>

act_clearcached.cfm does have a little output. see below
act_clearcached.cfm
<cfobjectcache action="clear">
<br>
<br>
<br>
 
<div align="center"><strong>All cached objects should now be cleared.</strong></div>

Open in new window

0
 
_agx_Commented:
No, you can't use cfinclude in a anchor tag.

1. You could either redirect to a page that includes that template. Then return to the previous page OR
2. Create a link to the current page with a paramater:
<a href="thePageWhereYouhaveTheLink.cfm?clearIt=true">Clear Cache</a>

Then at the top of the page, include the template only if that parameter exists:

<cfif structKeyExists(url, "clearIt")>
     <cfsilent><cfinclude template="members/act_clearcached.cfm"></cfsilent>
</cfif>

0
 
ShawnAuthor Commented:
tried solution 2 and works like a charm

thanks agx
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now