Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hi there

I have a site which has a page (tickets.html) which is a very simple, branded, loading screen which (after 3 seconds) redirects to a page on the ticketsource website, through which people can purchase tickets for that particular show.

At present this page achieves this by being set up as a regular html page that looks like most of our pages, but in the 'head' of the page, the meta tag says
Code: Select all
 <meta http-equiv="refresh" content="3; URL=ticketsource.co.uk/blahblahblah"/>


As it currently stands, this URL has to be updated in the html file every time we do a different show, and I really want to get it 'editable'.

I figured I had done enough weird and wonderful things with CouchCMS before to mean i'd be able to do it - but no success!! I think this is not because of coding errors, but because I am trying to do something using the wrong method.

So far I have tried (below I am simplifying the 'code' I used to aid readability - rest assured I used the correct characters to call the CMS code):

1. Simply changing the URL in the meta tag to a 'get_custom_field' which points to a globals.php variable called 'ticketsource_url' - this could not be parsed by the browser, and I simply got error messages stating incorrect character at line x char y

2. Using cms:redirect url='get custom field' as above, but again it could not parse and I (sometimes) got an error message along the lines of 'cannot find url "ticketsource.co.uk/<cms:get_custom_field 'ticketsource_url' masterpage='ticketsales.php'>" which somewhat proves that I am using the wrong method here...

I have played around with different combinations variables, such as setting the variable to the whole url, or only to the unique part of the URL, and then having the redirect either be "url='<get_custom_field ..." or "url='http:www.ticketsource.co.uk/<get custom field"

It's driving me up the walls, because I feel like this should be possible, and I fear I am missing the 'proper' or 'obvious' way to do it.

To clarify what I am attempting to do:

1. Have a field in the Admin Panel into which the ticketsource url can be pasted
2. Have a page (/tickets.php) which redirects to the url entered in the Admin Panel

Ideally it would redirect after 3 seconds (like the page currently does) but it doesn't need to - so long as mysite.co.uk/tickets.php redirects to a ticketsource URL entered in the Admin Panel

Thank you for any help you can provide!! If you want precise copies of the code I have tried I can provide it - but I'm fairly confident that this problem isn't that I've mis-typed code, but rather that I am going about this the wrong way...

Anthony
Hi,

Either of the two methods you tried should work - I don't see any problem with them.

Perhaps it is only a case of using the wrong syntax?
Please let us know the exact code you have tried using.
You're quite right - certainly the first method (meta tag calling the field) had a missing closing quote mark (just after the CMS get custom field) - very difficult to spot in my text editor because the colour coding was not picking up on the php, but when I posted my code in here and clicked preview it was suddenly a lot more obvious!!

Have managed to get it to work now - for anyone else trying to achieve this, the code snippets would be:

First page (mine was called 'ticketsales.php') to set the URL:

Code: Select all
<?php require_once( 'couch/cms.php' ); ?>

<cms:template title='Ticket Sales' executable='0' >

<cms:editable name='ticketsource_url' label='Ticketsource URL'
desc='Enter URL for Online Ticket Sales here'
type='text' validator='url'  />

</cms:template>

<?php COUCH::invoke(); ?>


And then a second page for redirecting (mine was called 'tickets.php') as follows:

Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<html>
<head>
  <meta http-equiv="refresh" content="3; URL=<cms:get_custom_field 'ticketsource_url' masterpage='ticketsales.php' />" />
  <link rel="icon" type="image/png" href="../IMG/favicon.png">
  <title></title>
   <link rel="stylesheet" href="../font-awesome-4.2.0/css/font-awesome.min.css" />
   <link rel="stylesheet" href="../CSS/menu/style.css" type="text/css" />
   <link href="../CSS/site.css" rel="stylesheet" type="text/css" />
   <!--[if IE]>
   <style type="text/css">
   /* place css fixes for all versions of IE in this conditional comment */
   .thrColLiqHdr #sidebar2, .thrColLiqHdr #sidebar1 { padding-top: 30px; }
   .thrColLiqHdr #mainContent { zoom: 1; padding-top: 15px; }
   /* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
   </style>
   <![endif]-->
   <link rel='stylesheet' media='screen and (max-width: 915px), screen and (max-device-width: 1000px)' href="../CSS/sitesml.css" type="text/css" />
</head>
<body class="thrColLiqHdr">
   <div id="container"><!-- InstanceBeginEditable name="header" -->
      <div id="header">
         <a href="../index.php" title="" rel="home"><img src="../IMG/banner1.jpg" align="left" alt="" /></a>
         <a href="../index.php" title="" rel="home"><img src="../IMG/banner2.jpg" align="right" alt="" /></a>
      </div><!-- end #header  -->
      <div style="clear:both"> <br /> </div>
      <div id="mainContent">
         <h3><i class="fa fa-spin fa-spinner"></i> Please wait...</h3>
         <p>We are redirecting you to the relevant page at 'ticketsource.co.uk'</p>
         <p>Thank you!</p>
      </div><!-- end #mainContent -->

      <div id="footer">
         <p style="font-size:85%">Powered by <a href="http://www.couchcms.com/" title="CouchCMS - Simple Open-Source Content Management">CouchCMS</a></p>
      </div><!-- end #footer -->
   </div><!-- end #container -->
</body>
</html>
<?php COUCH::invoke(); ?>


And for me, at least, that is now working!! Thank you! :D
3 posts Page 1 of 1