[TYPO3] inline user functions
Max Novikov
webmaster at lisa.org
Wed Nov 28 17:44:06 CET 2007
Hello Dmitry,
It's a bit more complicated than links overwriting. I have huge
file repository, which should be distributed to users according to
their access levels. I've seen several extensions which can do that,
in theory, but I would prefer to stick to original (pre-typo3) code,
since it's interconnected with lots of auto-scheduled tasks, like
collecting feedback, statistics, uploading interface, etc.
What I need is:
1. Parse content for link to the file (= custom tag) - parseFunc can
do that.
2. Custom tag should be replaced with output from user function. That
also seems to be doable with parseFunc, although I haven't seen exact
examples in the net.
3. Tricky part: output of the user function depends on several
variables. I see how to pass variables if they're part of the
page setup/template, but I don't see (may be I'm dumb) any obvious way to
pass them if they're part of the content. May be there's some way to
get parameters from custom tags? I.e. can I somehow define parseFunc
to read and parse things like <flink id="12" label="Meeting report"/>?
On the second thought, I'll be happy even with one variable, since I
can parse it within the function to produce what I need...
Can you provide me with just one example/lead on how to do
something like that?
--
Best regards,
Max mailto:webmaster at lisa.org
DDt> Hi!
DDt> Max Novikov wrote:
>> Can anyone, please, provide me with working example of how to combine
>> parseFunc and userFunc (I think they should do it, shouldn't they?),
>> so that user function can read several variables from content piece
>> and make appropriate substitution?
DDt> What kind of sunstitution? There is a hook to generally alter
DDt> content before it is sent to the browser. But I am not sure this is exactly what you need.
>> E.g., the way I do it without typo3:
>> ---
>> ...here you can get <?php my_user_function(5,"updated brochure"); ?> for the...
>> ---
>> The first variable is database id of the file, the second - the text
>> to appear on the link. Depending on the user access it should render
>> either url to download script or error.
DDt> Do you mean rewriting of links? There are several "secure
DDt> download" extensions in TER. You can check their source code for
DDt> information about rewriting links.
More information about the TYPO3-english
mailing list