Page 1 of 1

How to execute offsite plugin before php page loads.

Posted: Sun Aug 14, 2011 6:59 pm
by bobbkc
I don't know if I am wording the question right but I have not been able to find an answer to this problem that I am having. I have a plugin on my page that I have listed at the bottom. I have changed the domain to testsite so the link is not the actual link. This plugin works great after the page loads but does not show up in the view source option. What command or code would I use to have this plugin load prior to the page loading so the content will be available for view via the view source option? I have tried several methods from posts that somewhat similar discussions but they did not work. I am not a programer so I know just about enough to make me dangerous but I have created several php sites now so I am getting better. Thanks in advance for any input. Bob.

<script language="javascript">
var bid= 4575;
var site =2;
document.write('<script language="javascript" src="http://testsite.com/?bid='+bid+'&sitenu ... nt_results&'+ window.location.search.substring(1)+'"></' + 'script>');
</script>

Re: How to execute offsite plugin before php page loads.

Posted: Sun Aug 14, 2011 7:07 pm
by Jonah Bron
Why is it important that it be visible in the source? The reason it's not there is because it's placed with Javascript, so it's changed after the page is initially loaded. If you want it to be visible, do this instead:

Code: Select all

<script language="javascript" src="http://testsite.com/?bid=4575&sitenumber=2&tid=event_results&<?php echo $_SERVER['QUERY_STRING']; ?>"></script>

Re: How to execute offsite plugin before php page loads.

Posted: Mon Aug 15, 2011 4:10 pm
by bobbkc
I don't want the string visible, I want the contents of the plugin visible. The contents of the plugin are visible in my example at the top but only after the page loads. I want the contents loaded before the page loads so when I do a view source, it will show there. I am trying to make the plugin visible to the googlebot as the plugin has text and other links. Would I take the example that you have given me and just change ['QUERY_STRING'] to ['DOCUMENT_WRITE']? Thanks, Bob.

Re: How to execute offsite plugin before php page loads.

Posted: Mon Aug 15, 2011 8:01 pm
by Jonah Bron
I see what you're saying. No, just open up that URL in your browser and paste it into a <script> tag.

Re: How to execute offsite plugin before php page loads.

Posted: Tue Aug 16, 2011 3:10 pm
by bobbkc
Thanks for the trouble you are going to Jonah but pasting the url into the script tag only shows the results for that one event. (in this case an artist.) Since I am using the same template for all of my events the plugin will change text with each call for a different event but use the same template. The plugin works fine in php and html but loads after the page loads. I need it to execute the script and load prior to the page loading so the code will be visible to a googlebot. As it stands now the only thing that shows to the googlebot is the line shown above. Maybe I need some kind of server side include but I think that only returns static information and not executes a plugin file. I see this works on several similar sites to mine but I have no way of looking at the code they use to make this happen. Thanks again for your input. I know this is difficult or maybe even impossible as I have been searching for an answer for about a week and can't find anything that works. Bob.

Re: How to execute offsite plugin before php page loads.

Posted: Tue Aug 16, 2011 11:39 pm
by Jonah Bron
So you want the contents of that file to be in your page? Are you sure the Google bot scans the contents of <script> tags? You could use file_get_contents().

Code: Select all

<script>
<?php
echo file_get_contents('http://testsite.com/?bid=4575&sitenumber=2&tid=event_results&' . $_SERVER['QUERY_STRING']);
?>
</script>