This is the web site of Parva Design, a graphic and web design specialist and software provider. This site generally publicises the PageBlender product, a web design tool written by Parva Design.
Skip navigation

pageblender logo
the professional web building system
GET YOUR FREE 30 DAY EVALUATION NOW

Hints & tips

An occasional collection of hints and tips on using PageBlender

How can I #include just a part of a file
How can I test which page is being built
How could I use the imbedded #include command
How do I display a menu differently for each page
How do I use the new named variables
What are the new include files with a .var extension for

How can I #include just a part of a file

Sections can now be marked in include files by using
<!#section sectionname>
and closing the section with
<!#end sectionname>

Marked sections can then be included using a modified #include command
#include filename|sectionname
with a pipe character inserted between the filename and the section name

The file can still be #included in the normal way but, by using this method, only an individual section may be loaded

---back to top---

How can I test which page is being built

There are a number of ways, each being used according to the circumstances:

The most basic is by using the #ifval statement with the built in __PAGEID variable, which contains the name of the file being built without the path or extender (index for index.htm, etc).
#ifval __PAGEID pagename
output text or code
#endif

Of course the #else command can be included here if required and the standard OR logic (pagename || pagename) and NOT logic (!pagename) can be used. Another way is to use the #ifpage command in a single line:
#ifpage(pageid|output if true|output if false)

To test for a range of pages use "pageid,pageid"

To test for a number of page ids and apply rules according to the page use the #switch command
#switch __PAGED
#case pageid:
output
#break
#case pageid:
output
#break
#endswitch

With these controls it is possible to finely control what goes into each page.

---back to top---

How could I use the imbedded #include command

This is a great way of modularising your site.

Say that you have a navigation set which is in your header.inc file. What if you want to use it in another include file? The best way is to remove it from the header.inc file and save the code fragment into, say, navigation.inc, replacing it in the header file with #include navigation.inc. Now you've a re-usable navigation system and it's easy to edit.

Each include file is repeatedly scanned until there are no more #includes within it so quite deep layers are possible.

Watch out for those circular references though the system will just go on checking for #includes and processing them.

---back to top---

How do I display a menu differently for each page

This was the first reason for which the software was developed.

All that is needed is to test to see which page is active for each menu item and act accordingly:

#ifpage(index|Home|<a href="index.htm">Home</a>)

Or, for the menu to display the same for a number of pages use the comma

#ifpage(index,login,... etc

If you have some complex processing or imbedded commands which do not transform using this method then you can use the #ifval command

#ifval __PAGEID index
Home
#else
<a href="index.htm">Home</a>
#endif

To use multiple pages in this block you cannot use the comma but can replace this with a double pipe || - #ifval __PAGEID page || page || etc

---back to top---

How do I use the new named variables

These are really very easy to use. Assuming that you are familiar with the %s variable marker all you do is use %s="name"

to mark the place for the named variable A name can be used more than once for repetitions of the same thing:

#define _menuitem_ <tr><td onclick="javascript:location='%s="link"'"><a href="%s="link"">%s="text"</a></td></tr>

uses the link variable twice.

In the page content all that is needed is the line:

_menuitem_[=link:mypage.htm][=text:My Page]

and the job is done. And, of course, because they now have names the variables can be replaced in any order.

---back to top---

What are the new include files with a .var extension for

These files are special in that they are always included in every page built in the project.

These were designed to contain common variable definitions but they can, of course, be used to automatically include anything.

You will need to bear in mind that the contents of these files are included at the very beginning of a page, where variables would normally be defined so, unless you are usng absolute positioning with DHTML the content may not appear where you want it. To include content where you want it in normal circumstances you would use the #include command with a normal .inc file.

---back to top---