| | |||||
| ||||||||
| CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
![]() Join Date: Jul 2005 Location: Coffs H, Australia
Posts: 3,456
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | |
| |
| | #2 (permalink) | ||||
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Just a note, really no need to use eregi_replace. str_replace will do the job just fine, and is faster than both ereg(i)_replace and preg_replace ![]() And I'll include a quote from the php manual
Last edited by SecondVersion; 04-20-2006 at 08:36 PM.
| ||||
| |
| | THREAD STARTER #3 (permalink) | ||||||||
![]() Join Date: Jul 2005 Location: Coffs H, Australia
Posts: 3,456
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Thanks 2ndver , I'll change it now, every little bit of optimization counts.Just did a test on the two, and you're right 2ndver .????: NamePros.com http://www.namepros.com/showthread.php?t=189417 This is with preg_replace:
- Every little thing counts!
__________________ Free Forums / GoDaddy Coupon Codes (NEW DOMAIN!) / Free Arcade Script / <?='Your computer is '.(1?fine:broken).'.'?>
Last edited by BillyConnite; 04-20-2006 at 08:47 PM.
| ||||||||
| |
| | #4 (permalink) |
| Resistance is Futile Join Date: Apr 2006 Location: Montreal, Canada
Posts: 1,094
![]() ![]() ![]() ![]() ![]() ![]() | Thanks for the script, I will definately use it. You can almost make an entire CMS system based on that, sweet!
__________________ Freelance Web Developer PHP, MySQL, XHTML, CSS, Javascript, jQuery, Wordpress Portfolio: www.bundy.ca |
| |
| | #5 (permalink) | ||||
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| ||||
| |
| | THREAD STARTER #7 (permalink) |
![]() Join Date: Jul 2005 Location: Coffs H, Australia
Posts: 3,456
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | No problem , hope it helps!
__________________ Free Forums / GoDaddy Coupon Codes (NEW DOMAIN!) / Free Arcade Script / <?='Your computer is '.(1?fine:broken).'.'?> |
| |
| | #8 (permalink) |
| Senior Member Join Date: Jan 2006 Location: Portland, Oregon
Posts: 2,102
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Sorry to ask. I am not a php expert. But what exactly would this do? What is the difference from making a phpinclude and just include it in pages? Thanks, Camron
__________________ HostingFuze.com Premium Master Reseller Services | 99.9% Uptime Guaranteed SLA | Starting at $4.95/mo Basic Reseller Hosting @ HostFz.com - Services starting as low as $1.95/mo! |
| |
| | #9 (permalink) | ||||
| NamePros Regular Join Date: Aug 2005 Location: NY, USA
Posts: 610
![]() ![]() ![]() ![]() ![]() ![]() |
Putting {TITLE} on a page is a lot safter than <?=$pagetitle?>
__________________ ask me about the internet | ||||
| |
| | THREAD STARTER #10 (permalink) |
![]() Join Date: Jul 2005 Location: Coffs H, Australia
Posts: 3,456
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | ^^ What Jim said .It's good too though so that when your selling a php script, and have a template system that parses the pages, the template can be written in 100% html or css so if the buyer has no php knowledge it is much easier and not confusing for them to create a template for the script than when using includes. All the best, Rhett.
__________________ Free Forums / GoDaddy Coupon Codes (NEW DOMAIN!) / Free Arcade Script / <?='Your computer is '.(1?fine:broken).'.'?> |
| |
| | #11 (permalink) |
| Senior Member ![]() ![]() Join Date: Apr 2005 Location: .ma.us
Posts: 1,880
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | i used this code to make this network of minisites. www.treeguide.info all of em use the design located at www.treeroots.info/design.html Thanks man
__________________ |
| |
| | THREAD STARTER #12 (permalink) | ||||
![]() Join Date: Jul 2005 Location: Coffs H, Australia
Posts: 3,456
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
No problem, glad it helped
__________________ Free Forums / GoDaddy Coupon Codes (NEW DOMAIN!) / Free Arcade Script / <?='Your computer is '.(1?fine:broken).'.'?> | ||||
| |
| | #13 (permalink) |
| NamePros Regular Join Date: Apr 2005 Location: England :D
Posts: 834
![]() ![]() ![]() | Hi, This template system is great, but im having trouble using php on the page. Putting php in the array doesnt work. e.g. PHP Code: thanks, -ed |
| |
| | THREAD STARTER #14 (permalink) |
![]() Join Date: Jul 2005 Location: Coffs H, Australia
Posts: 3,456
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Hey ed, What you could do is parse the php you want in the array first? So instead of say: '{CODE}' => '$variable=1+1*10' You could do: $variable=1+1*10; '{CODE}' => $variable Ofcourse it'd work with any functoins etc you wanted also... BUT I believe there is another way to do it, forgotten how though, I'll see if I can find it for you.
__________________ Free Forums / GoDaddy Coupon Codes (NEW DOMAIN!) / Free Arcade Script / <?='Your computer is '.(1?fine:broken).'.'?> |
| |
| | #16 (permalink) |
| New Member Join Date: May 2006
Posts: 3
![]() | I am trying to add images on same way but it wont show it.... DO i need to make some function to display images? t $images="images/some.jpg" to array i add {IMG} => $images to design.html <p>{IMG}</p> but i just see error on line $images, and it only show "jpg" in this line where it call for images.. THnx |
| |
| | #17 (permalink) | ||||
| NamePros Regular Join Date: Feb 2006
Posts: 528
![]() ![]() ![]() ![]() |
$images = "<img src='images/some.jpg' border='0' alt='' />"; {IMG} => $images Regards, Peter | ||||
| |
| | THREAD STARTER #18 (permalink) |
![]() Join Date: Jul 2005 Location: Coffs H, Australia
Posts: 3,456
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Hey crow, If the page is in a folder, then usually the image path will be wrong as compared with that folder... if you know what I mean. So you'll have to try the full path i.e. http://domain.com/images/image.jpg instead of just images/image.jpg Let me know how it goes, Rhett.
__________________ Free Forums / GoDaddy Coupon Codes (NEW DOMAIN!) / Free Arcade Script / <?='Your computer is '.(1?fine:broken).'.'?> |
| |
| | #21 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | I've edited it just a tad, if you don't mind me posting it here Billy ![]() PHP Code: ![]() Taken from Billy's original post, replacing w/my changes: PHP Code: Code: <html>
<head>
<title>{title}</title>
</head>
<body>
<p>{content}</p>
</body>
</html> |
| |
| | #22 (permalink) |
| NamePros Regular Join Date: Dec 2005
Posts: 210
![]() | umm ok i need to make a news system udner one of my pages and im using this template system...the sites is kinda small since its for a school project anyway so how would i go about adding the news system in the content area? would i hve 2 make a completely new file with the news system and do: $page = new Page("pages/news.php"); |
| |
| | THREAD STARTER #23 (permalink) |
![]() Join Date: Jul 2005 Location: Coffs H, Australia
Posts: 3,456
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Hey 2nV, thanks for the update - Original post updated with some credit for your help.wackyjoe, im not quite sure what your getting at. This system would only be used for websites looking to maintin multiple templates, if your only going to use one, then there really is no need at all. Rhett.
__________________ Free Forums / GoDaddy Coupon Codes (NEW DOMAIN!) / Free Arcade Script / <?='Your computer is '.(1?fine:broken).'.'?> |
| |
| | #24 (permalink) |
| NamePros Member Join Date: Dec 2005
Posts: 186
![]() ![]() | Is it possible to output alot of content and some PHP within the array? Would I have to do something like: PHP Code:
__________________ DNFind.net - For sale, PM me. |
| |
| | #25 (permalink) |
| NamePros Member Join Date: Jun 2006 Location: ohio
Posts: 26
![]() | Hrmm.... not to be any party pooper... but this code looks remarkably similar to CodeWalkers Template Tutorial located at: http://codewalkers.com/tutorials/58/8.html
__________________ WHERE'S MY RUM?!! ((in your hand...)) OH! |
| |