By Andrev-1 on
I've been playing around with Drupal now for about 24 hours and I am a newb with the software. What I am trying to accomplish is fairly straight forward. I want to use an Image instead of Text as the forum title. I run into a problem when I type straight HTML into the field and save. What happens is that the HTML code is saved to the database correctly, but when it goes through the Theme() function, the brackets (<.....>) get stripped off. I looked at the Theme() function and well I dont code OOP yet. So I am having a substantially difficult time figuring out where there may be a replace for my HTML code.
Can anyone help me?
Comments
Easy, I think....
Are you saying that you want the title of each forum to be an image? Is this true for each forum title?
Like:
- General (a section and the title is an image)
-- Post 1 (title is image)
-- Post 2 (title is image)
And, are you looking for the these images to be more than text in a different font than you can use with the web?
--
Matt
http://www.mattfarina.com
Not so sure you understand
What I want specifically is:
Container Title as [text or image]
--Forum 1 Title as [text or image]
--Post Title as Text
--Forum 2 Title as [text or image]
--Post Title as Text
etc...
I am volunteering my time to help a friend of mine with his site at http://www.woldiangames.com. The site has images as the forum titles. Go visit and look in the golden arena and you will see what I mean.
I want to use an
<img src="........">in order to make the title of the forum into an image. What I am seeing when I do this is that the HTML brackets get stripped off when they run through the themeing functions.signwriter module
You should look into the signwriter module. It can create all kinds of text graphics on the fly, with caching for previously generated images.
J
Code
So I went into the code to check this out, the forum function that controls the way the forum is displayed is here:
Now I modified the above code to try to force an image into the link. However, I messed up somewhere in the syntax, because PHP says it is expecting a ')' and is getting a ',' .
The line modified is
$description .= ' <div class="name">'. l(.'<img src=".'$forum->name'.">.', "forum/$forum->tid") ."</div>\n";Anyone see the error or know more about the link function defined by the L()? I sure could use some help here.
Regards,
Steve
SOLVED
This is Solved. You can make the forum link IMAGE based by going into the common.inc core file.
FIND:
and change the variable $html = FALSE to $html = TRUE.
Basically the function will html encode the link changing a (") int ", etc.. I tried just adding an $html=TRUE to the link function call.. ie
l($forum->name, "forum/$forum->tid", $html=TRUE), but that did not work. I had to change it in the common.inc file.DON'T DO THIS
Don't do this... it's hacking the core. All of this is themable without making changes to the core files. If you change them maintenance just became a real pain.
Instead use a page-forum.tpl.php page, a node-forum.tpl.php page, and contemplate to get what you want in a look. In this case it's proper usage of the page-forum.tpl.php file.
--
Matt
http://www.mattfarina.com
Why Not?
I do not believe this is themeable. What I want is essentially a script that will parse through the database and show the images instead of the text for each forum. If you can explain to me how this is themeable with an example, I will gladly do that instead of changing a core file.
The thing is after 24hrs you
The thing is after 24hrs you are thinking of messing with the core - could come back to haunt your friend when you're long gone.
Agreed...
I agree with Matt. This can, pretty simply, be done by using Contemplate and CSS.
Theme functions should always remain theme functions. You shouldn't use drupal itself to change display...there's always a theme-way to do it.
Hacking core rarely a good idea...
if ever a good idea.
This is true, hacking core files can be problematic. But one thing I'm curious about is why isn't $html = TRUE working? It seems from the API docs that should work for them, but it isn't. I'm trying to use it to add a simple span, and it's not working as expected either. l() api docs say that if the $text is html such as in the case of using and image for the link, that I can use $html = TRUE for it not to plaintext it and expose the html code. Yet it doesn't work.
Anyone have any suggestions as to why it's not?
d'oh
Um... because I had one too many ,NULL 's thats why. *sigh*
SO... a solution for the Op
Use this:
It worked for me. under 5 (I think it's the same under 4.7, check api.drupal.org to be sure)...
I tried this for Drupal 6,
I tried this for Drupal 6, but without success. Anyone know how to set html to true in D6?
I'm also using contemplate and the function l()
My knowledge of php is limited...