LiveZilla Live Help

Our Online Blog

We have put together this blog to help, inform and inlight users regarding the internet, development and design. We also post all our network updates here to make sure you keep up to date with whats going on around you.

Search Blog

Posts Tagged ‘Railo’

ColdFusion pagination with next, previous and numbers

Friday, March 12th, 2010

One of the main things all developers come to in applications is pagination and the best way we found to do this is by Raymond Camden which covers how to create next and previous buttons for your content using the URL variable.

As we have extended what Raymond Camden has done we will go through all the code again to make sure you get the full picture.

First part is to get our data, which most of the time will be a database or as the second data example shows a queryNew which is a way of creating data in a query format without the need of a database query.

<cfquery name=”data” datasource=”data_dsn”>
SELECT *
FROM data
</cfquery>

OR

<cfset data = queryNew(“id,name,age,active”,”integer,varchar,integer,bit”)>

<cfloop index=”x” from=”1″ to=”22″>
<cfset queryAddRow(data)>
<cfset querySetCell(data,”id”,x)>
<cfset querySetCell(data,”name”,”User #x#”)>
<cfset querySetCell(data,”age”,randRange(20,90))>
<cfset querySetCell(data,”active”,false)>
</cfloop>

Next we want to set the number of records per page we would like to show, for this example code we are using 10:

<cfset perpage = 10>

Now we create the code for the URL variables which counts the records in the data we have got from our database / query. We also set the default of the variable URL.start to 1 as we want to start from the first record and not 0.

<cfparam name=”url.start” default=”1″>

<cfif not isNumeric(url.start) or url.start lt 1 or url.start gt data.recordCount or round(url.start) neq url.start>
<cfset url.start = 1>
</cfif>

The output of the data, you will notice on our <cfoutput> tag we have startrow & maxrows which sets what records are displayed.

<cfoutput query=”data” startrow=”#url.start#” maxrows=”#perpage#”>
#currentrow#) #name#<br />
</cfoutput>

And now this is when the code that Raymond Camden created changes a little to add in a new feature, page numbering. We first have a previous link which has an if statement around it to see if its a link or not and enable the <a> tag or have no link on it. This can be done different ways but to keep with Raymond Camden’s code we will leave it as it is. Now the new part you can see within the commented area (<!— Start Page Number —> CODE <!— End Page Number —>) we set 2 variables one for a page count as we need to have a number of pages that will be listed. The next one is page link, this is to fit in with the rest of the code and add the number that will need to be added within the link to view the numbered page. Next is a loop to go through the number of pages with the link and a small bit of VERY simple maths to add up the next page through the loop.

<p align=”center”>

[

<cfif url.start gt 1>

<cfset link = cgi.script_name & "?start=" & (url.start - perpage)>

<cfoutput><a href="#link#">Previous Page</a></cfoutput>

<cfelse>

Previous Page

</cfif>

/

<!--- Start Page Number --->

<cfset pageCount = 1>

<cfset pageLink = 1>

<cfset totalPages = Ceiling(rs_getReports.recordCount / perpage)>

<cfloop index="c" from="1" to="#totalPages#">

<cfoutput>

<a href="?start=#pageLink#">#pageCount#</a>

</cfoutput>

<cfset pageCount = pageCount + 1>

<cfset pageLink = pageLink + perpage>

</cfloop>

<!--- End Page Number --->

/

<cfif (url.start + perpage - 1) lt rs_getReports.recordCount>

<cfset link = cgi.script_name & "?start=" & (url.start + perpage)>

<cfoutput><a href="#link#">Next Page</a></cfoutput>

<cfelse>

Next Page

</cfif>

]

</p>

Thats it, you will now have something that looks like this:

Paging

Base code taken from Raymond Camden’s coldfusionjedi.com :

http://www.coldfusionjedi.com/index.cfm/2006/4/24/ColdFusion-and-Pagination

Polar CMS in alpha testing

Wednesday, March 10th, 2010

After 3 months of development first staging of the Polar CMS script has been released to our testers / designers to start playing with.

Process of our testing

  • Running the install program to setup the databases and user accounts
  • Use the basic functions of the CMS:
    - Add pages
    - Add page elements to change
    - Use the WYSIWYG editor
    - Apply code to front end site to test speeds
  • Consult with development team to see how things can be improved

Next steps

  • Design second simple admin template / style sheet for simple viewing (Less images / design factor)
  • Develop modules system ready for alpha testing as this is still in development as one of the main features of the systems
  • Speed & load testing to make sure the script uses the smallest amount of CPU

We will be updating the Polar CMS website soon with some of this information. Also a new website will be released soon.

Visit polarcms.com

Using ColdFusion Custom Tags (cf_)

Thursday, January 7th, 2010

A new part of ColdFusion our development team has been looking into more is the custom tags (cf_). Soon to be used with the Polar CMS (Visit official site), custom tags allow you to have scripts and coding within a tag that can be called from a cfm page as shown below:

<!— CFM Page (cfcustomtag_caller.cfm)—>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
<title>Call Tag</title>
</head>

<body>
<cf_cfcustomtag customVar=”test”>
<p>SOME HTML</p>
<cf_cfcustomtag form=”testFormCode”>
</body>
</html>

As you can see we are using a new tag <cf_cfcustomtag> with custom variables (customVar=”test”). These variables can be picked up within our custom tag cfm file we are about to create.

<!— CFM Page (cfcustomtag.cfm)—>
<cfoutput>
<cfif isDefined(“ATTRIBUTES.customVar”)>
<h1>#Now()#</h1>
<p>#ATTRIBUTES.customVar#</p>
</cfif>
<cfif isDefined(“ATTRIBUTES.form”)>
<p>#ATTRIBUTES.form#</p>
</cfif>
</cfoutput>

The above is a simple CFM file which has HTML and ColdFusion code. As you will notice we have named the file ‘cfcustomtag.cfm’ which is the same name as the tag: <cf_cfcustomtag> just without the cf_ at the start. Coldfusion will look for any files with the same naming tag.

You may ask why not use a <cfinclude> tag, but with cfincludes they can be slower and you are not able to reuse the cfinclude as easy as a cf_ custom tag. With custom tags you can lower the amount of code you need by using the extra variables (ATTRIBUTES).

Hope you enjoy using custom cf_ tags. Feel free to comment and add your code to show better ways of using cf_ tags. You may also want to research <cfmodule> tags.

Happy New Year Everyone!

Friday, January 1st, 2010

Hello Everyone!

A new year, a new start for some but for us we aim to improve al our services over 2010. As from our last blog posts you will see Railo is now fully up and running with people already starting to use the services without any reported issues.

The new year will bring the following improvements:

  • Design and usability changes to our website
  • Integrated design of the Host Issues forum
  • Better server status system to help track any issues on the servers
    - We have already begun this by adding every server we have on the server status page. Check the server stats (Opens in new window).

New services coming in the new year:

  • Free Wordpress blog hosting on a subdomain so if you dont want to pay for your blog then we can offer a great free service
  • VPS servers with options of FFmpeg / Railo

We hope you have a great new year from everyone at Host Media UK and AeonCube Networks

New Walla Walla, Washington State DC and Services

Thursday, December 10th, 2009

After long talks with the Vivio Data Centre in Walla Walla, Washington we have now agreed a contract to have new servers placed within the fantastic facility. With this new data centre comes new services which include Linux based Railo hosting which allows you to host .cfm files without the expense of ColdFusion.

Railo 3.1Railo comes with many great features that allow you to use the power of ColdFusion without spending out for the hosting. Railo is also more stable and faster than the ColdFusion engine.


Features

  • Use most of the ColdFusion tags and custom tags from the Railo team.
  • Your own cfadmin to add mappings / datasources / etc
  • Open source built so we can work on adding new connectors and system addons
  • Works with the following ColdFusion frameworks:
    1. Coldbox
    2. Transfer ORM
    3. CFWheels
    4. Fusebox
    5. Mach II
    6. Reactor – ORM
    7. Model Glue
  • Supports most database types including MySQL, MsSQL, PostgreSQL, Access, etc

Our view of Railo

As ColdFusion based developers finding a easy to use and powerful scripting language that can handle our clients requirements is a huge plus. This is why ColdFusion was picked as the main development language for us, when we heard about Railo we were very excited about the idea of a server side software that will use almost everything that ColdFusion does but open source and free. As you may know ColdFusion Standard has a price tag of over £800 (Ext VAT) for 1 server licence which for many is alot to invest in.

We are now moving our scripting plans to be able to handle both ColdFusion and Railo so if you use our scripting services you dont need to worry about expense of ColdFusion and use Railo.

Railo on ordering

As we will be offering railo services to all LxAdmin hosting package apart from the basic package you will have Railo Activiated on your account within 48 hours after ordering as our team does need to add your account to a XML file that handles the paths for your hosting. All other features of your hosting will be enabled straight away which will include PHP, MySQL etc.

LxAdminLxAdmin (Kloxo)

Kloxo (Previously Lxadmin) is trivially the most advanced and flexible hosting platform on this planet. From Kloxo HostinABox that can run a full featured hosting on 15MB RAM to Kloxo Enterprise, which is only truly distributed hosting platform in the industry, Kloxo is a single software that can power all areas of your hosting business, whether it is powering your entire shared hosting or simple control panel that you can sell with your VPS offering.

Why LxAdmin

We have picked LxAdmin for this new server and service due to its low preformance requirements and its easy to use interface. Similar to cPanel in many ways, this control panel allows you to manage every part of your website hosting.

DNS Information

dns5.hostmediauk.com
dns6.hostmediauk.com

Packages / Ordering / Pricing

At the current time we are working on the websites detail page for Railo / LxAdmin hosting and our team is deciding on the best pricing structure for this. We think basic LxAdmin hosting without Railo will start at £5 per year and will be listed with the hosting packages under ‘Shared Hosting’. Railo Hosting will be a dedicated section on our website with all information regarding its features and what you will be able to use on the hosting package.

We will post more information here on our blog in the next day or so.