Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Create function to return a preset height

Quote Reply
Create function to return a preset height
Hello,
I created a div tag in templates to setup the height of the contents (or a section of the templates), and I sat it up like this:

Code:

<div id="<%height_of_div>%>">

How do I write a global or a function to return the "height_of_div" value?
Note: The returned value should be height_4, height_5...etc. which are declared in the CSS file (e.g. #height_4 = 400px;)


The function/global should be something like:


Code:

hight_of_div {
<%if home_flag == 1%>
height_4
<%elseif login_flag == 1%>
height_5
<%endif%>
}

the flags sat based on the page type .. (e.g if it is the home page, then I put <%set home_flage =1%> after the <body> tag.

Thanks
Mark
Quote Reply
Re: [Mark2] Create function to return a preset height In reply to
Hi,

Do you really need a function?

In include_header.html, do something like:

Code:
<%if home_flag == 1%>
<%set height_of_div = "1234"%>
<%elsif login_flag == 1%>
<%set height_of_div = "1100"%>
<%elsif search_flag == 1%>
<%set height_of_div = "900"%>
<%else%>
<%-- default height, where no "flags" are set --%>
<%set height_of_div = "1000"%>
<%endif%>

..and just add as many "flags" as you want (obviously you need to "set" these flags in the templates, i.e in search.html / search_results.html, you would do: <%set search_flag = "1"%>)

Then, whereever you wanna use that "height", you would simply call it with:

<%height_of_div%> (be sure to remove the global too, otherwise it will stop that variable working Smile)

Hope that hepls

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Create function to return a preset height In reply to
Lovely ... thanks much Andy Smile