| | |
str_replace help needed
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
0
#11 30 Days Ago
You would need to run the new string through eval to make the includes work.
Use that function with caution though. If you don't use it right there are huge security risks.
Use that function with caution though. If you don't use it right there are huge security risks.
Google is your friend.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
0
#12 30 Days Ago
You would need to run the new string through eval to make the includes work.
Use that function with caution though. If you don't use it right there are huge security risks.
Use that function with caution though. If you don't use it right there are huge security risks.
Google is your friend.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
Use [code] tags.
If you have found a solution to your problem, please mark the thread as SOLVED.
•
•
Join Date: Sep 2009
Posts: 525
Reputation:
Solved Threads: 61
0
#13 30 Days Ago
can you post the part of your code here, we will modify it
"The discipline of writing something down is the first step towards making it happen."
follow me on twitter
follow me on twitter
•
•
Join Date: Oct 2009
Posts: 15
Reputation:
Solved Threads: 3
0
#14 30 Days Ago
PHP Syntax (Toggle Plain Text)
<?php $file_path = "modules/gallery/index.php"; include ($file_path); $file_path = str_replace("gallery","enquiry",$file_path); include ($file_path); ?>
•
•
Join Date: Oct 2009
Posts: 15
Reputation:
Solved Threads: 3
0
#15 30 Days Ago
PHP Syntax (Toggle Plain Text)
<?php $file_path = "modules/gallery/index.php"; include ($file_path); $file_path = str_replace("gallery","enquiry",$file_path); include ($file_path); ?>
0
#16 30 Days Ago
Is [GALLERY] inside <?php ?> tags?
I would manually code the include where you want.
One way would to be use authoring software like DW to search and replace [GALLERY] with <?php include("gallery/index.php"); ?>
also kkeith29's idea is a great possibility, but comes with risks.
I would manually code the include where you want.
One way would to be use authoring software like DW to search and replace [GALLERY] with <?php include("gallery/index.php"); ?>
also kkeith29's idea is a great possibility, but comes with risks.
Last edited by liamfriel; 30 Days Ago at 8:33 am.
They throw us away like yesterdays jam - Maurice Mossley
Please - rep if someone helps you, it can't be traded for stuff, but it's nice.
Please - rep if someone helps you, it can't be traded for stuff, but it's nice.
•
•
Join Date: Sep 2009
Posts: 9
Reputation:
Solved Threads: 0
0
#17 30 Days Ago
Hi Guys,
Thank's for all your help so far.
Sure. I have 2 files pulling this together so far.
index.php
global.php
As you can see, the content is stored in a mysql database.
What i would like is that when someone stores somthing like this in the database:
Contact Us
[enquiry]
Or browse view our gallery
[gallery]
They will appear from an includes. $pager['code'] is pulling the content for the page.
Zack.
Thank's for all your help so far.
Sure. I have 2 files pulling this together so far.
index.php
PHP Syntax (Toggle Plain Text)
include('includes/global.php'); DisplayIndex();
global.php
PHP Syntax (Toggle Plain Text)
function DisplayIndex() { ConnDB(); $index = mysql_query("SELECT * FROM pages WHERE url='index' AND page_group='0'") or die(mysql_error()); while($pager = mysql_fetch_array( $index )) { include('build.php'); include('_lang.php'); include('seo.php'); include('design/1.php'); echo $pager['code']; include('design/2.php'); } }
As you can see, the content is stored in a mysql database.
What i would like is that when someone stores somthing like this in the database:
Contact Us
[enquiry]
Or browse view our gallery
[gallery]
They will appear from an includes. $pager['code'] is pulling the content for the page.
Zack.
Last edited by Zack_G; 30 Days Ago at 9:26 am.
•
•
Join Date: Sep 2009
Posts: 36
Reputation:
Solved Threads: 4
0
#18 30 Days Ago
Hmmm, am I missing something as I don't understand why you are doing it that way why not make your path then include it...
As an example.
As I said I might have missed something.
php Syntax (Toggle Plain Text)
$path = "includes/" . $pager['code'] . "/index.php"; include( $path );
As an example.
As I said I might have missed something.
•
•
Join Date: Sep 2009
Posts: 9
Reputation:
Solved Threads: 0
0
#19 30 Days Ago
Hi,
Basically a client can login and update the content of there webpage. This content is saved to a mysql database.
Onto the next part, when the mysql database content is pulled and displayed on the actual webpage during a echo i need to be able to scan for tags, for example [enquiry] or [gallery] and include the relevent file for that tag.
Let's say the customer udpates the content of there index page to say "This is my index page. Why not email me using our contact form [enquiry]" then we need to include enquiry.php.
Currently everything works apart from the whole issue with searching and replacing tags with the relevent include file.
Zack.
Basically a client can login and update the content of there webpage. This content is saved to a mysql database.
Onto the next part, when the mysql database content is pulled and displayed on the actual webpage during a echo i need to be able to scan for tags, for example [enquiry] or [gallery] and include the relevent file for that tag.
Let's say the customer udpates the content of there index page to say "This is my index page. Why not email me using our contact form [enquiry]" then we need to include enquiry.php.
Currently everything works apart from the whole issue with searching and replacing tags with the relevent include file.
Zack.
0
#20 30 Days Ago
This would be very annoying as you would need to stop outputting the database information, place the include(); and then start echoing out the rest.
I would have no idea where to start with something like that.
One idea would be to load both pages into a variable at the start names $enquiry and $gallery and output them that way.
I would have no idea where to start with something like that.
One idea would be to load both pages into a variable at the start names $enquiry and $gallery and output them that way.
Last edited by liamfriel; 30 Days Ago at 1:40 pm.
They throw us away like yesterdays jam - Maurice Mossley
Please - rep if someone helps you, it can't be traded for stuff, but it's nice.
Please - rep if someone helps you, it can't be traded for stuff, but it's nice.
![]() |
Similar Threads
- How to export data from mysql into fields in excell (PHP)
- Cannot modify header information.Headers already sent (PHP)
- Harddrive failure and 100% CPU under Win2K, Help Needed! (Windows NT / 2000 / XP)
- XP PRO iis help needed (Windows NT / 2000 / XP)
- CWS. help needed (Viruses, Spyware and other Nasties)
- are all these needed (Windows NT / 2000 / XP)
- help much needed !! (OS X)
Other Threads in the PHP Forum
- Previous Thread: Validation in Zend Framework Not working in Index Controller
- Next Thread: Php mysql image scroll script??
| Thread Tools | Search this Thread |
apache api array beginner binary body broken cakephp checkbox class cms code computing cron curl database date date/time delete display dynamic echo email error file files filter folder form forms function functions gc_maxlifetime global google host href htaccess html image include insert ip javascript joomla limit link list login mail memmory memory menu mlm msqli_multi_query multiple mycodeisbad mysql navigation oop parameter parsing paypal pdf php problem query radio random recourse recursion regex remote script search seo server sessions sms snippet source space sql static syntax system table thesishelp tutorial update upload url validator variable video web webdesign wordpress xml youtube






