I can simply tell you that in PHP you can change text strings if they have been saved in a variable. But if you want to manipulate the DOM you have to use JavaScript.
Starting from my suggestion, on the Internet you will find many guide.
Yes, really need more information on the circumstances. Do you want to be able to do on-the-fly changes to your site from an admin point of view, or are you hoping to be able to make these changes at run-time? If the latter, then as above you need to be looking at Javascript because, once the page is rendered, your PHP has finished executing.
Thanks, but is website translation or language translation mechanism done by java?
I know i can change div content using java but there are php ways that changes every word in php before is being echoed
Thanks, but java is not a secure approach to what am looking for.
E.g i want a conditional php statement like this if age = 17 then hide the subit button
This is what i intend archiving, is very easy to do if i can wrap the submit button in a variable.
But sad enough those content is dynamical coded to output different form ids and is not such i can edit them manually.
So am looking at a kind of filter that will add or wrap my own function around them
There is what is called gettext() and ngettext() in wordpress which i use most times to translate woocommerce submit button texts and some other texts like change the word posts to feed, Archives to Library e.tc.
But for some reasons it does not work for code replacement where i want to use such approach to rewrite <div id=1 into not available
Study the below code, i picked it from gravity forms documentation, they used domdocument functions which i suspect it could be a java language but if is not java, then i will like to understand how to use them solve me problems.
Is this really a php language? If it is then am interested in learning how to use it, but if it is a java or client side language then no need pressing
If all you want to do is conditionally replace text and considering your example of a submit button then why not either
a) read the file contents into a string and do a search / replace before it is executed
b) use an if… else to echo the desired html code conditionally
c) place the various code elements in separate files and use include() to place the desired html code
I am confused now, If you do not have the source code, how do you know what you want to replace and how are you ever going to replace it
If you have access to a file then the process would be something like
<?php
$content = file_get_contents("filename");
$newcontent = str_replace("text to replace", "replace with this", "$content");
file_put_contents("filename", "$newcontent");
?>
Basically read the file contents into a string $content, create a new string with the items replaced, $newcontent and save it. But you have then lost the original and replaced it with your new version. So you need at some point presumably to set it back again. I think you need to provide more info. But the example above will modify a file contents.
OK then you should be able to use the example I provided, however if you are loading the results of a web page automatically into a file you are basically web ‘scraping’. This is a technique used by some to extract emails for spamming or other data.
Some web developers will try and protect against this so you may have to experiment and research before you get a good result
I am still unsure how you will access a completed html page, replace elements in it and then republish it to a user - it seems very convoluted.