Hi everybody,
I'm trying to set some persistent variables but I didn't figure out how to do that with Couch.
I know how to use DataBound Forms to record some data from a form, but here I'm trying to automatically update a field on a clonable template, with no action from the user.
I'm trying to set up a kind of URL shortener, let's say a "redirector" that will record referrer and counts. I want to know how many people used the shortened URL and from which referrer URL they come from.
Each shortened URL is a unique page of the clonable template. Here what I've got for now :
The "name" of the page represents my shortened URL. When the page is called, the user is correctly redirected.
Do you know how to update "counter" and "referrers" for each call of this page?
Or perhaps do you a better way to do what I want?
Thanks.
I'm trying to set some persistent variables but I didn't figure out how to do that with Couch.
I know how to use DataBound Forms to record some data from a form, but here I'm trying to automatically update a field on a clonable template, with no action from the user.
I'm trying to set up a kind of URL shortener, let's say a "redirector" that will record referrer and counts. I want to know how many people used the shortened URL and from which referrer URL they come from.
Each shortened URL is a unique page of the clonable template. Here what I've got for now :
- Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title="URL Shortener" clonable="1">
<cms:editable name="redirect_to" type="text"/>
<cms:editable name="counter" label="Counter" type="text"/>
<cms:editable name="referrers" label="Referrers" type="text"/>
</cms:template>
<cms:if k_is_page>
<cms:redirect url=redirect_to permanently="1" />
</cms:if>
<?php COUCH::invoke(); ?>
The "name" of the page represents my shortened URL. When the page is called, the user is correctly redirected.
Do you know how to update "counter" and "referrers" for each call of this page?
Or perhaps do you a better way to do what I want?
Thanks.