|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#31
|
|||
|
|||
|
RE: help : looping for template
When having a function like this:
you will have only one row in that block, which is rather useless, isn't it? Making another function with a multi-dimensional array in case of a query isn't too difficult. Just use a for-loop to loop trough the firt part of the array ($list[$i]) in case of the while-loop with (mysql_fetch_array($query)); Calling it would then be like: If I had the time, I would write it for you, but I haven't... Greatz, BlackSkad |
|
#32
|
|||
|
|||
|
RE: help : looping for template
EDIT Looks like Blackskad and I posted at the same time...
Anonymous, I guess I don't understand what you mean... The purpose of the replace_block_tags() method is to display repeating areas of dynamic generated results - namely results from a MySQL database query. With a static array, you can just use the replace_tags() method for that. Or is this a repeating array from a different source than a database? If that's the case, you could add a new method replace_array_tags() or something, using the replace_block_tags() method as a guide and just replace the db stuff with php array functions. |
|
#33
|
|||
|
|||
|
RE: help : looping for template
I could never get the replace block tags to work....
What array functions would I have to use to replace the mysql data? |
|
#34
|
|||
|
|||
|
RE: help : looping for template
We'd really need to know more about what you want to accomplish to help you build a new method for this class. It sounds like you have a specific goal/situation you'd like to address. But like has been said above, if you are just using one static array, you should not need to use the replace_block_tags, you can just use the replace_tags method.
Show us some code or explain in detail what you would like this class to do. Who knows, there may be others out there who'd like to do the same thing... :-] |
|
#35
|
|||
|
|||
|
RE: help : looping for template
Well I am trying to get it similar to what phpbb has for the assign_block_vars function. It displays the data in the array in a block. That is handy if you want to hide something or not. Also you can add it to a for statement and then have it repeat the data also.
I hope this helps. I can go into more detail if need be. |
|
#36
|
|||
|
|||
|
RE: help : looping for template
yeah that would be nice...
Having sumtin like phpbb's assign_block_vars where so you'd call it like so... I got it to work awhile ago with looping.. then comp crashed and i didnt save my work.. now i gotta do it all over again..meh |
|
#37
|
|||
|
|||
|
RE: help : looping for template
Now although i got it to work...with looping...
the last idea would be sweet. |
|
#38
|
|||||||||||
|
|||||||||||
|
RE: help : looping for template
Normally, it would just be as easy as this:
php Code:
I haven''t test it though (no time), so it is possible there still something wrong. Note that there is a crucial difference in the last line, compared with the one below (check the second argument). The function is designed to be used multiple times. So every time you use it, you replace the original code by "the replaced code" concatenated with the original part. So after 1 times calling, the block mentioned in the previous post would look like this: php Code:
If you replace the last line in the function with the one I mentioned in the note, you''ll get something like below. Your items are printed on screen in the reverse order. The one you replaced first, will at the bottom of the page. php Code:
Your choice which way you like best... |
|
#39
|
|||
|
|||
|
RE: help : looping for template
I can't get it to work. I have tried everything you posted.
|
|
#40
|
|||
|
|||
|
RE: help : looping for template
Does it gives any error? would be usefull to help...
|
|
#41
|
|||
|
|||
|
RE: help : looping for template
|
|
#42
|
|||
|
|||
|
RE: help : looping for template
Did you replace the word 'blockname' in the tag with the real name of the blog? So you have something like
That almost seems like the only possibility for a mistake, because the functions works fine on my testing-server... |