Jump to content

[SOLVED] Setting a variable value on a page after you use it


ShadwSrch

Recommended Posts

I am new to .php.  I seem to remember that the script is parsed before it is run, so you can define a variable value after it is used...This seems counterintuitive, so I don't know if I am remembering correctly, or if I missinterpreted what I read.  In any case, I can not seem to come up with a good way to word a search to find the answer.

 

I am using a content management system (Joomla!)...the system sets up a standard 3 column layout.  Modules can be placed in the left  hand column, and the content is generated in the center column.  I want to write a module (Left hand column) that queries the database based on the content page (center column).  This causes the module to be generated before the content.  Can I dynamically put information into the module using a variable that is set in the content itself?

 

Specifically, I want to put a team roster up for the team chosen.  The content page shows the team's schedule and picture, and the roster goes on the left of the content.

 

I can statically create a module for each team's page, but I wanted to do it dynamically.

 

Any help would be appreciated, and let me know if I need to clarify anything.

 

BTW...any further questions about this project will be separate manageable posts...I hate it when someone uses one thread to work through a huge project...

Link to comment
Share on other sites

I think you are confusing the issue.  What you really need to find out is which is processed first, the creation of the center area or the creation of the other modules?  If the center portion is created first, obviously that information will be available to generate your other area.

 

I would also have to assume that if the center is generated based on the fact that other data is dictating the output of the center, wouldn't that data also be available to you to determine what to generate in your other module?

 

 

Link to comment
Share on other sites

First, let me thank you for your reply.  It does answer my question...

 

Here is an EXTREMELY simplified portion of the page:

<td id="left">
<?php mosLoadModules('left', -2); ?>
</td>

<td id="middle">
<?php mosMainbody(); ?>
</td>

<td id="right">
<?php mosLoadModules('right', -2); ?>
</td>

 

I did know that the center section was processed after the Left side...I just thought I read somewhere that you could use a variable before a value was assigned to it...I thought that it was strange, but it seems that either I misread it, or they were wrong.

 

As is usually the case, I need to rethink my problem.  I will see if the designation for the article content changes when it is edited, and if not I will try to use that.

 

Thanks again.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.