How to edit dynamic page - php

Learning how to code by editing an existing dynamic pages site that is live.
Have a question on how to edit dynamic pages.
For ex: I want to edit static text on a page. I can figure out stuff using firebug and seeing html, nodes, etc but I have no idea how to find the correct/relevant file on my server to edit and make changes the static text so something else. I see CSS files, js files. Is it a php file maybe? Where should I look? Maybe other files? Can't seem to figure out! Thanks for your help!

If the text comes out of a database/CMS, you'll have to search the database.
If the text is hard-coded in the code itself, use a search utility on that set of folders to find a match.
You can't always tell looking at the output on the client to determine the source unless you're familiar with the code.

Related

(PHP) Find tag in HTML in the main file

I'm working with a lot of different web pages and I need a solution to change HTML code, which I can't find by myself. I know it would be best to find the source of the problem and change it but it isn't possible in every case. Almost all pages are made in various types of CMS (WordPress, PrestaShop, Shopper, etc.). Sometimes I have several problems to find, where I can change code to do my tasks. Sometimes I have a webpage, which is blocking some files for me.
I'm looking for a solution, which would work like this:
I don't know where I can find a source of my problem
I have access to index.php or another file, which include end/beginning of HTML tag
I'm making changes in these files and I'm not looking deeper in a code
I worked before in another company, where we were using some types of regex to read HTML code and we were saving it to a variable (string with HTML code) and we could change code in this string without looking for a file, where HTML code was written/generated by PHP.
Unfortunately, I have no idea how it was done. I will be very glad for any type of help!

how to link own css/php file in Typo3 file.inc

sorry for the bother.
I've already searched for a while but since i'm not practical with TYPO3, either i don't understand if what i find is useful or i don't search well cause i don't know what to search. I ask sorry in advance.
I've this project to do for my university, and i've been asked to implement a form with the underline Database to registry peole who enters in the Department and ask for them to activate the card.
I only use .inc files in fileadmin/phpinclude folder to create my pages.
What i'm not able to do is to link my own css and php files.
For example i have form.inc which should use my style.css i tried to link it through the classical html way:
<link href="fileadmin/php_include/accessi/style.css" rel="stylesheet" type="text/css">
but it doesn't work , instead, if i use an "in-page" css it works.
i think i'll have the same problem with a php file.
Could anyone, please, explain what i should do?
Thank you.
Sounds a little unsual to use external php files for building forms in TYPO3. The usual way would be to write an extension or use TYPO3's own native form component.
And the usual way to include css files in TYPO3 would be to include it via typoScript: https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Page/Index.html#includecss-array
But if you want to do it in the way you described above, it sounds pretty much like the uri to your css file is wrong. Maybe it is because you are using a relative url. Checkout the DEV-Tools of your browser and see what HTML response code the call the css resource returns. In Chrome you can see that on the "network" tab. You will also see there what absolute uri the browser called and maybe you get a clue what is wrong with your uri.

How Do I Use PHP Includes to Display HTML pages?

I have my web page setup to use a new management system, but would also like to use some basic html pages for other content (such as images or whatever), and I seem to remember from years ago that there was a way to use PHP to load HTML pages that are not formatted into a content area, which I assume are DIVs.
I also seem to remember that I didn't have to create an if statement, but I'm not sure and quite honestly I'm awfully confused about how to do this. A friend used to do this coding for me way back when, so the way it was setup was that all I had to do was tell my navigation where to find the file and it would load it inside of my index.php file.
Hopefully my question is clear, but if not, my website is right here, and I just want my HTML files to load into the are with the content image, but only the grey portion (which I do have a DIV set up for). Any help would be much appreciated! Thanks!
The simplest way is by using require and include.
for more details, you can visit the following link:
http://www.w3schools.com/php/php_includes.asp
For example:
<?php include 'footer.html';?>

how do I find out what php function from Wordpress is generating blocks of HTML using browser inspector?

I'm developing a Wordpress site, which I'm fairly new to. I'm not sure if this is a stupid question or not but I haven't been able to return any decent google results regarding this. Anyway, is there a way to find out what PHP function is generating a piece of HTML code using a browser code inspector like Chrome's? Thanks!
No.
Once the data arrive to the browser, all the PHP code have been processed and you can't know what part of PHP generated which part of the HTML code.
No - not without modifying the php code to enable some kind of debugging. Chrome can only give you information about the received html document on the client side (you). But php code gets parsed server side.
You kind of can:
Download a copy of the theme and plugins folder
Open the page on your site that you want to find the function for.
Find a div/class that is specific to section e.g. <article>
Open a text editor like notepad++ (one that will allow you to search through multiple files at ones)
Use the find feature of chosen text editor and search for the div/class
The result will show you a list of pages where that term is.
Look through those pages for the function you are looking for (it might take a few goes)
The above it is a bit of a roundabout way of doing it, but I think other than looking through each file separately, it is you next best way.

Best way of loading content that should appear on every page

Until now, I've been using the <iframe> tag to load things like headers/footers/navbars into my webpage. These cause so much hassle though and as I'm about to start building a new site I thought I'd get it sorted now.
I was thinking of having all the html code in a php file and just loading it in dynamically.. Ideally I'd like the code to become a part of the page. So it appears inline. But I also want to be able to edit one single file if I need to change one bit rather than editing the same file 100 times.
<iframe>'s did this well until recently and I don't want to use workarounds to solve my problems. Could someone please post some code I could adapt or post a link to something that tells me how to do this? Cheers
You can use PHP's include() function to include elements like headers and footers in your pages.
So:
include('header.php');
. . . will look for a file called header.php in the same directory and include it in your page. Then you just need to write this at the top of your pages.
That said, this isn't really a very good way to go about designing your site. How about looking for a content management system, that allows you to keep the design and content of your site separate?
Are PHP includes what you're looking for ? http://php.net/manual/en/function.include.php

Categories