FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » can one make a php function or macro with arguments to generate HTML code?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: can one make a php function or macro with arguments to generate HTML code? [message #181781 is a reply to message #181771] Sat, 01 June 2013 14:22 Go to previous message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma:
Senior Member
On 6/1/2013 6:21 AM, steve nospam wrote:
> I am newbie. I am writing HTML and find myself duplicating lots of
> code, which is the same except for 1 or 2 names/items in it.
>
> I do not know how to make a function or macro that takes arguments in
> HTML or CSS. Then I read that php is much more powerful and one should
> code HTML pages in php.
>
> Here is an example of what I have, I am just asking for a hint or a
> link on how to code this in php.
>
> <div class="blabla">
> <video poster="folder_name/image.png" controls>
> <source src="folder_name/movie.ogv" type="video/ogg">
> <source src="folder_name/movie.mp4" type="video/mp4">
> opps, browser does not support the video tag.
> </video>
> </div>
>
> The above block of HTML close is repeated many time. Each time, a
> different "folder_name" is used.
> So I end up copy/paste and edit this code many many times.
>
> It would be nice if I can define a function, and just pass it the
> folder_name and it returns back this whole code. So the above becomes
>
> <div class="name">
> make_video_code("ABC")
> </div>
>
> <div class="name">
> make_video_code("ADR")
> </div>
>
> <div class="name">
> make_video_code("ACB")
> </div>
>
> etc.... you get the idea.
>
> Is something like this possible? Does any one have a templates or
> example of how to do this in php? where to put the function
> make_video_code()?
>
> thanks
> Steve
>

In my case I use a program called NoteTab Pro for that. Not notePAD, but
NoteTAB; it's an excellent text editor and html generator with the
ability to, among many more things, hold templates and/or clickable
read-only files in one of its many clipbooks. Short learning curve,
inexpensive Pro version, and a pay-for Pro version is available.
Creating your own specialized clips is also easy; just highlight/copy
and then go to the clip pane and witch to the Clip pane and paste; the
highlighted part then becomes available at one double-click.
NO affiliation; just a long time user here.

You can check it out here:

NoteTab – A Prize-Winning Text Editor and HTML Editor

www.notetab.com/‎
NoteTab gets more done in less time. Try it! ... NoteTab Pro is another
of those utilities that once you have tried it, you won't go back. Jerry
Pournelle, BYTE ...
Download - NoteTab Light - Comparison Chart - This Prize-Winning HTML ...
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: UML
Next Topic: Best Online Shop
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 11:13:28 GMT 2024

Total time taken to generate the page: 0.05570 seconds