Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved Find+Edit var/funcs? How to literally write template var in actual PHPfile?
#1
Not Solved
I have worked with a lot of HTML and done some work with Bash, PHP, AHK, CSS... so I know some of the basics just from years of hands on usage, but it's all self-taught by trial and error coupled with online research.

I'm having trouble making my brain come to terms with exactly how some of these things work... Here are the quickest explanations of the situations that have arisen for me.

Let's say I'm looking in a template and I see {$goat_master_load} and I sit there with my eyes bugging out because I have NO idea what that could be loading up in that template. What EXACTLY is the correct method of locating the spot that the variable is created? In other words, how do I find and go to the spot that tells that variable what to say? And how do I edit it myself? (assuming I have NO CLUE where it could be by its name, which is why I used a random example nobody would recognize lol)

Next up... (very important: please help!)
Let's say I'm editing the PHP page that, when converted to template, will show the code {$goat_master_load} but obviously when I am editing the raw PHP file, you cannot just slap that in there. I need to know the PHP equivalent to calling that same information. How do I literally write that out in PHP-file-friendly format to output the same variable content as {$goat_master_load}?

I found a perfect example of what I mean! Big Grin
Take this:
cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}"
What's the method for looking at that and knowing exactly how to find AND edit those 2 variables' values? This is one I have yet to figure out specifically. I can figure out their values by looking at converted coding on the source of the page it creates, but what I'm trying to do is locate where it physically gets created and I want to edit those values.




Currently what I do when I come to something like the above problems, is start searching for both filenames and file content that matches the terms I am confused about. So in the above example I'd start going into SSH and grep for "goat" related terms to see what comes up. I'd also go into the Admin CP of MyBB and start using the search options for templates and template titles. Sometimes though... I still can't find the answer I'm looking for. I've even experimented with searching through the MySQL database in some occasions; sometimes having partial luck in getting answers and other times not. Sometimes I'll search for something like
$var = "definition is written here"
and end up finding it in a file, and can edit it! Smile ...but other times, I can't even find anything close to the things I am looking for. There just seems to be no rhyme or reason so I know I'm missing something.

What are the more efficient and effective ways to figure out the source/location/definition/etc for variables and functions I run into?
Reply
#2
Not Solved
For core functions, I personally look here: http://crossreference.mybboard.de/nav.html?_functions/index.html

For core variables, I look here: http://crossreference.mybboard.de/nav.html?_variables/index.html

For anything not in the core (eg: added by a plugin), I just hope the plugin author has used a sensible function/variable name so I can trace back to the plugin file.

As for outputting a variable, you can just use echo:

PHP Code:
<?php

$someVar 
'Hello, World!';
echo 
$someVar// will print out "Hello, World!" to the page 
Reply
#3
Not Solved
(12-23-2012, 11:07 PM)euantor Wrote:  For anything not in the core (eg: added by a plugin), I just hope the plugin author has used a sensible function/variable name so I can trace back to the plugin file.

[/php]

That's one of the things that happens to me.... I'm left "hoping" lol but I have run into cases where I found something that I was unable to trace back to anything. What do you do when that happens? Ultimately I want to be able to find the spot in which the variable was created and can be edited by me.

Also, what's the correct way to write out {$this} type of variable when editing the actual PHP file itself? There is some PHP-equivalent that I'm not able to figure out... Basically it would be written in some way that, when converted into the template, looks like {$this} and pulls the content of that variable.

I found a perfect example of what I mean! Big Grin

Take this:
cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}"

What's the method for looking at that and knowing exactly how to find AND edit those 2 variables' values? This is one I have yet to figure out specifically. I can figure out their values by looking at converted coding on the source of the page it creates, but what I'm trying to do is locate where it physically gets created and I want to edit those values.
Reply
#4
Not Solved
(12-23-2012, 11:18 PM)CheckingThis Wrote:  
(12-23-2012, 11:07 PM)euantor Wrote:  For anything not in the core (eg: added by a plugin), I just hope the plugin author has used a sensible function/variable name so I can trace back to the plugin file.

[/php]

That's one of the things that happens to me.... I'm left "hoping" lol but I have run into cases where I found something that I was unable to trace back to anything. What do you do when that happens? Ultimately I want to be able to find the spot in which the variable was created and can be edited by me.

Also, what's the correct way to write out {$this} type of variable when editing the actual PHP file itself? There is some PHP-equivalent that I'm not able to figure out... Basically it would be written in some way that, when converted into the template, looks like {$this} and pulls the content of that variable.

I found a perfect example of what I mean! Big Grin

Take this:
cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}"

What's the method for looking at that and knowing exactly how to find AND edit those 2 variables' values? This is one I have yet to figure out specifically. I can figure out their values by looking at converted coding on the source of the page it creates, but what I'm trying to do is locate where it physically gets created and I want to edit those values.

got to admincp->templates & style->themes->themename then edit them there they are at the bottom of the page just below the board logo option
Not in this land alone,
But be God's mercies known,
From shore to shore!
Lord make the nations see,
That men should brothers be,
And form one family,
The wide world ov'er

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)