Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php loading modules query 2

Status
Not open for further replies.
Not entirely sure what you are asking.

In a url like that, index.php is the only thing that can be said to run.

What you can determine from that URL is that index.php runs and receives 3 parameters which it may or may not do things with.

There is no folder there, and now way to know what it is doing with those parameters. It could be completely ignoring them. But since we don't know what the code of index.php does there's no way to know what those parameters mean if anything.

Its the equivalent of:

index.php?flavor=vanilla&syrup=chocolate&cherries=yes, you could assume its making an icecream but it could very well me making a pancake. no way to know what the end product will be just based on the parameters.

Its just getting values in variables passed to it, and the code decides what to do with them.

If its then calling in extra files, or additional code based on those parameters that is independent, and cannot really be determined by the URL.




----------------------------------
Phil AKA Vacunita
----------------------------------
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech
 
Looks to be a CMS url that is showing a 'browse list' of members ordered by an attribute of 'members' called 'reputation'.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.

Never mind this jesus character, stars had to die for me to live.
 
Ive attached a picture of folders, for instance the above url, the file called is browse.phtml in the reputation folder is called, if I make changes to it, its reflected in the browser. I am trying to add my own file but it says file not found, ive done exactly same as browse.phtml but still says file not found

php_ido37y.jpg
 
Ive copied the exact link construction as above but changed controller to ebay because that is the folder and the action to importebay and filter is a command within the file to open

Code:
	<li><a href="<?php echo $this->url(array('module' => 'members', 'controller' => 'ebay', 'action' => 'importebay', 'filter' => 'open')); ?>"
		  title="<?php echo $this->_('Import From Ebay'); ?>"><?php echo $this->_('Import From Ebay'); ?></a>	</li>

importebay.phtml file
Code:
        switch ($filter) {
            case 'open':
                $filterLabel = $this->_('Selling Open Filter');
                break;
            case 'closed':
                $filterLabel = $this->_('Selling Closed Filter');
                break;
            default:
                $filterLabel = null;
                break;
                 ..............etc


Just get and its exactly the same just another folder but same file, do I have to list it somewhere has available?

404 Error

The page you are looking for could not be found.

Try checking the URL for errors, then hit the refresh button on your browser.
 
There is probably some code in an "index.php" in one of the folders that redirects or provides a 'context' based on the URL parameters for the data to be retrieved.

Knowing what CMS it is may be more useful than a naked folder list, as we have absolutely no idea what code is in the folders.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.

Never mind this jesus character, stars had to die for me to live.
 
Sorry Chris its all PHP with extensions .phtml and this is the only thing in index.php im abit suspicious about the cube application?

Code:
ini_set('display_errors', 1);
error_reporting(E_ALL);

define('APPLICATION_PATH', realpath(__DIR__));

set_include_path(APPLICATION_PATH . DIRECTORY_SEPARATOR . 'library');

require_once 'Cube/Application.php';

$application = Cube\Application::init(include 'config/global.config.php');
$application->bootstrap()
        ->run();

 
This is a nightmare, seems everything runs on modules and controllers and links are ran from xml file

Code:
                            <address_book>
                                <label>Address Book</label>
                                <module>members</module>
                                <controller>account</controller>
                                <action>address-book</action>
                            </address_book>

How would i implement my new file around this?
 
As I said, and Chris explained as well,

How you would add a new module or controller or index depends on what the PHP code is doing with the variables passed to it. The part with module=...&controller=...&action=...

Is just passing variables to index.php to use and access the code.

You need to mimic that layout somehow to add more code to it. Its also possible it uses some type of master list of modules and its controllers and actions to get the proper paths to whatever it retrieves based on those variables.

Just get and its exactly the same just another folder but same file, do I have to list it somewhere has available?

We absolutely cannot tell you how to that. We have no idea how its working, or what its doing to determine how to load modules controllers and actions based on the variables.

You have access to the core PHP code, you can tell us what its doing in index.php with the module, controller an action variables.


Just for arguments sake, and assuming a straight forward layout for this. is there a file called "browse.phtml" inside the reputation folder that is inside the members folder?
ttcms_eeqdg3.jpg


----------------------------------
Phil AKA Vacunita
----------------------------------
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech
 
Sorry for delay, yes there is a browse.phtml in reputation, if you look at this ML file called navigation, it also shows the links

Code:
                        <label>Feedback</label>
                        <module>members</module>
                        <controller>reputation</controller>
                        <action>browse</action>
                        <resource>Reputation</resource>
 
Is there a project application to step threw to find out where it is going? I use to use one for c++
 
Is there a project application to step threw to find out where it is going?

That's kind of what we have been asking for.


It's just XML and somewhere in the code for the site will be a parser for the XML that is coded in PHP.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.

Never mind this jesus character, stars had to die for me to live.
 
I don't think you'll find an app that will tell you what some PHP code is doing or where variables are being used.

Stepping through the code is generally a manual process in PHP. Follow the code, and to see what its doing exactly.

Now that we know there's a browse.html there, we can at least test to see if it is straight forward usage, or if it s doing something more.


If you save a file in the reputation folder called test.phtml that includes some very basic code:

Code:
<?php
echo "<h1>This is a test</h1>";
?>

If you call: test

Does that do anything?





----------------------------------
Phil AKA Vacunita
----------------------------------
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech
 
using this link and uploading test.phtml

Code:
[URL unfurl="true"]http://www.mysite.co.uk/index.php?module=members&controller=reputation&action=test[/URL]

I get

404 Error

The page you are looking for could not be found.

Try checking the URL for errors, then hit the refresh button on your browser.

I may as well show you the site because its still in its infancy, I have turned off SEO's

 
No errors here, all I get is the home page for bad bidders. If the link is producing an error, that means the code is doing more than just reading the parameters from the URL, and you will need to find out what that is.

Since we cannot see the code, there's no way for us to know what it is doing.

I would suggest you hire someone that knows PHP and can go through the code and understand what it is doing.



----------------------------------
Phil AKA Vacunita
----------------------------------
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech
 
Ok i will, could i ask, what is this doing?

Code:
$application = Cube\Application::init(include 'config/global.config.php');
$application->bootstrap()
        ->run();
 
$application = Cube\Application::init(include 'config/global.config.php');"
is; Instantiate object $application and 'include' constants and variables from a configuration file.


"$application->bootstrap() ->run(); "
is 'call' method bootstrap in object application and 'call' method run in application

The -> is generally called an "arrow" (or single arrow) and is used in Object Oriented Programming (OOP) to refer to a method or property of an object.



Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.

Never mind this jesus character, stars had to die for me to live.
 
It is statically calling the function or method init() from the class definition "Application" that exists in the "Cube" namespace, and passing to it an include command with a filename so it adds extra code and probably variable definitions from the specified file.

It then assigns the result of the init() function to the variable $application. That result is apparently an object.


It is not really instantiating anything we can see.

It then accesses the object assigned to $application to run and access its methods and properties.

It calls the method run() from the object generated by calling the bootstrap() method that is part of the object that was assigned to the $application variable.

Other than that, its hard to say what those methods actually do inside themselves.



----------------------------------
Phil AKA Vacunita
----------------------------------
OS-ception: Running Linux on a Virtual Machine in Windows which itself is running in a Virtual Machine on Mac OSx.

Web & Tech
 
Thanks, i get that that, its member functions, would there be a library somewhere holding the files necessary for the site like "vacunita" explains?

just adding a another file ie: test.phtml gives an error so there must be other areas that need test.phtml adding
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top