Extending 3rd Party Mod

Get ready to laugh at me, I forgot to initiate the listener for it. Added it and now I have an error with code typo. So now we can narrow down where the issue is for loading the variable.
 
Get ready to laugh at me, I forgot to initiate the listener for it. Added it and now I have an error with code typo. So now we can narrow down where the issue is for loading the variable.


I'm pretty sure no one is going to Laugh :)
 
Since I am here, I can't remember the code to search a template for a certain line and replace it. Anyone have an idea on that?
 
In a template hook or template post render event, you can use str_replace or preg_replace to do replacements. The first is the more simpler of the two. Simple find a string and replace it with another string. preg_replace is much more complicated as you search for a regular expression.

Plenty of docs online for those.
 
In a template hook or template post render event, you can use str_replace or preg_replace to do replacements. The first is the more simpler of the two. Simple find a string and replace it with another string. preg_replace is much more complicated as you search for a regular expression.

Plenty of docs online for those.
I didn't realize that method was the same. Figured since it was Zend it would be different.
 
News to me. I know Zend is built on PHP but using it as a framework makes coding for XenForo quite different which is why I thought it was different. Thanks anyway.
 
News to me. I know Zend is built on PHP but using it as a framework makes coding for XenForo quite different which is why I thought it was different. Thanks anyway.
Building on a framework has its own functions on top of core PHP functions to make things easier in cases. Example, in Zend Framework:
  • Zend_DB provides wrappers for connecting to a database, so you could easily switch between database infrastructures without changing a bunch of core code to reference mysqli vs mysql or what now.
  • Zend_Crypt provides an abstracted method of hashing, so you provide a hashing algorithm to identical functions, but it can return several different hashes without changing your code.
Those are just two examples that provide solid examples while developing on top of a framework is different than straight PHP, but straight PHP is all you are doing. Zend Framework isn't a different language, just a different path to access built in functions (or provide new ones).
 
And the different "coding experience" you mention, Mythotical, is likely because of the MVC principles and object oriented approach that XenForo has adopted.
 
Thank you both for that insight. Can't say that I was enlightened when I first started with XenForo 2 years ago but again learn something new everyday.
 
Top Bottom