Jump to content

Roaches

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Roaches's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Assign class "class" to $this->class variable, which is does do, accessing it with $this through a child class after that function has been called is the problem.
  2. I just realized that I forgot to add the fact that the test function inside of class A was called prior to class C being initialized, so it wasn't trying to pull the class out of a function that wasn't even called. Sorry about that.
  3. I'm trying to initialize a class within a function that is inside a class and use that class within an extended class, but having a problem with the extended class not being able to find it. Not the exact code I'm using, but same structure: class A { function test() { $this->class = new class; } } class B extends A { function B() { $this->class2 = new C; } } class C extends B { function C() { $this->class->function(); } } But I get a "Call to a member function function() on a non-object" error. It works if I do this, but I would prefer not to have to do it if I don't have do: class C extends B { function C() { global $a; $a->class->function(); } }
  4. I'm trying to figure out the best way to organize data in my mysql database (for a php project). I have a single entry that will have several items for a single field, for example: id | event | dates | etc Using this example, one event might have several dates corresponding to it. My first thought would to just serialize an array with all the dates and place it in the dates field, but as far as I know there isn't a way to order the output of the query by each of those dates. So my other solution would just have another table called something like "event_dates" where it would contain the id of the event and a single date, but I'm worried that might not be the best solution. So my question is what would be the best way to go about this? Would having a separate table containing individual dates create more overhang than having them all be in one field or is there another solution I just haven't been able to think of?
  5. I was wondering how it to shorten a html formated string without it being split in the middle of a html tag. I can get the function to ignore the html tags when counting how many characters are in the string by just using the strip_tags() function, but once the string is passed the length without html tags it'll split some tags that lie between the break point. For example, if the following string is set to break at 25 characters, it would break the 'a' tag. This is example text, <a href='#'>link</a> more random text. Is the a regex or some other method to ignore all html tags except <p> when using substr() to shorten the string?
×
×
  • 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.