Re: javascript find/delete
"David Jeske" <[email protected]> Tue, 20 Jan 2009 15:49:47 -0000
| Newsgroups | gmane.text.clearsilver.general |
|---|---|
| Message-ID | <[email protected]> |
The task you've descibed is not one which I would typically do with clearsilver. While some manipulation of data is possible in clearsilver, it is not intended to be a full programming langauge such as PHP. Clearsilver is designed to be used with a programming language such as Python, C, or Java. If your goal is to load an HTML document, remove some of the contents of the document, and send it otherwise intact, I would use Python instead. However, I think there is more help I could provide if you explain more about your application. For example, I don't typically store data as an HTML document. Instead I would store it as a set of fields, perhaps in a database, or in HDF files. I would make a clearsilver template with the navigational HTML, into which these fields are inserted to construct a fully valid document. This puts the format of the website (such as navigational links, header, and footer) in a handful of templates, instead of every stored document. An explanation of the goals of your application and answers to the following questions can help me give you some more suggestions: 1) why are your stored files 'html documents'? 2) where are the documents stored? (in the filesystem? in a database?) 3) why are you storing data as a html-table within the document? What code is editing this html-table? Have you considered storing the file in a format other than html? 4) how many 'documents' are there? 5) how do users normally edit the 'html table' at the bottom of the document? -- andrew_d_kendrick wrote: > i've just started working with clearsilver and have very little > experience programming. i'm trying to make a clearsilver template > that searches an HTML document "page.document.content", finds a table > and deletes it each time someone looks at the page. (there may be a > better way to do this, i.e. without tables) > > i've added an HTML table at the bottom of our documents that users > add/delete certain information so that i can filter the documents > based on what was added or deleted in the table. i don't want this > information visible to people looking at the document, but i want it > to exist on the backend so i can filter/search it. > > The only thing i've been able to make work is the following .cs > template: > > backchop.cs > <?cs set:backchop = string.slice(page.document.content, 0, -515) ?> > <?cs var:backchop ?> > > The problem is that when people add/delete the wrong amount of data, > backchop deletes more than just the table and screws up the HTML. > > Thanks - andy > > > ------------------------------------ > > Yahoo! Groups Links > > >