Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
themes-topic
Recommended way to output HTML?
Avatar
Lee H
Coastal New England (USA)
Member
Free Members
sp_UserOfflineSmall Offline
Jul 22, 2011 - 12:15 pm

Looking at the default template, all output is returned by functions. If we wanted to output HTML markup (or anything else)...  well I'm not sure the best approach.

Do we jump out of php and write the HTML directly? Or do we have to create oodles of functions to return the output? Or should we save the functions output to a variable like $out.= function_that_returns_stuff(); and return $out in the end like the old SP coding?

Your thoughts are appreciated.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jul 22, 2011 - 3:26 pm

personally I would mark it up in-line although that choice is a bit subjective I guess and dependent upon ones usual work practice. But in-line is fine,

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jul 22, 2011 - 8:34 pm

you will see we mix jumping out of php for straight html and echo'ing html...  really just a preference or amount of html needed... I am getting to where I like to jump out of php and just dump the html...  easier to handle indentations...

Avatar
Lee H
Coastal New England (USA)
Member
Free Members
sp_UserOfflineSmall Offline
Jul 22, 2011 - 8:50 pm

We can echo? I did see echoing in some of the functions and assumed it was a option to output to the main blog in a widget or something.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jul 23, 2011 - 5:32 am

Yes echo or raw html. No more $out and return. ALL template functions echo unless you specify otherwise in the arguments and use 'get'.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Lee H
Coastal New England (USA)
Member
Free Members
sp_UserOfflineSmall Offline
Jul 23, 2011 - 8:16 am

LOL! Had I realized that... I wouldn't of asked this question. So this really IS like a WP theme 🙂

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jul 23, 2011 - 8:38 am

Yep. Even has 'loops'...

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jul 23, 2011 - 9:54 am

😉

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17364
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625