Revision [4294]
This is an old revision of ProgrammingHelp made by JavaWoman on 2005-01-09 08:59:14.
Programming Help
Many people work at developing various aspects of code for wikka and yet we often struggle for hours, or even days, to solve programming problems that others in the wikka community know the answer to. Even more of an issue, sometimes coding problems aren't rectified until after initial code releases and feedback from other members lead to new code being posted (which means that the old code might now be running on others' wikka implementations) because the initial developer could not figure out how to solve a problem. To reduce these problems, this page is intended for people to be able to pose programming issues they've encountered and have the opportunity to draw on the knowledge of others' in our community as to how to resolve those issues. There are two sections...."Issues Needing assistance" & "Solved Issues". When a user has either solved an issue on their own that they've posted, or received help on the issue that satisfactorily addresses it, then the solution should be posted and it should be moved from the first to the second category.Issues Needing Assistance
Only single copies of generated images on a wikka page
In developing my WikkaGrapher action I have it both generating an image and wikka code (that calls an action) that can be placed on a page to place the graph on the page. The action is below (saved as graph.php) and examples of the code are at http://gmbowen.educ.unb.ca/wiki/wakka.php?wakka=Sandbox5 (the code generating interface is at SandBox6). Only the code for the first image is processed for some reason (as can be seen at Sandbox5). Not surprisingly, I'd like users to be able to place more than one graph on a page. Ideas? The graphing engine is at http://www.phpclasses.org/browse/package/1993.html.<?php
echo '<img src="./scripts/graphmaker.php?'.$code.'><br \>';
?>
echo '<img src="./scripts/graphmaker.php?'.$code.'><br \>';
?>
- Three problems with that code:
- the break tag should be written as <br /> (note the forward slash)
- just like the break tag the img tag should be closed - but isn't: - you need ' />' at the end (not just '>');
- once you do that the main problem causing only one image to appear becomes more visible: the src attribute has only an opening " but not a closing one
- Change the code as follows:
<?phpBTW, why not use the nice features of class.graphic.php to let the user specify the data it needs as separate action parameters and let the class generate the query string? That would be much more user-friendly. That's what OO is all (well, mostly) about: hiding the complexities... --JavaWoman
echo '<img src="./scripts/graphmaker.php?'.$code.'" /><br />';
?>
Solved Issues
Multiple copies of actions
Not being able to put multiple copies of an action on a page. Can be caused by multiple copies of the same functions being loaded. Solution: have the functions "included" from a separate file using include_once() which stops repeated loading of the functions. Example where implemented: WikkaForumCategoryDevelopment