HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Including Non Alpha-Numeric Codenames

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#32217 (In Topic #7308)
Joe
Avatar

Honoured member

Excuse the PHP noobie, but is it possible to include extra information in the codenames? I know ocPortal doesn't let you, but would it be easy to allow it? Of course, something like this may require a lot of new code and file edits, and I'm not a registered member, but if it's not easy and simple to do, has the idea of making this possible in future versions ever came up? The thing is, my site offers downloads. Most people like a list of downloads on one page with a thumbnail representing the item - this way they don't have to click every item just to see what the item is. Seeing as the Downloads Module doesn't support thumbnails, I was thinking of adding my own Downloads System, but this would require extra information in the URL's.

Ex:
  • mysite.com/index.php?page=downloads (System Index)
  • mysite.com/index.php?page=downloads&id=245 (Item Index)

With just creating a new Comcode page, I can add my own thumbnails next to each item - understand what I mean?




Last edit: by Joe

Back to the top
 
Posted
Rating:
#32250
Avatar

Seeing as the Downloads Module doesn't support thumbnails

It does actually :). Each download has a gallery of images, shown within it. The first gets used as a thumbnail, if the download categories are being viewed in the larger view mode (I can't remember what we call it, but there's a toogle link in the download category view).


To address your actual question, I think this could work. Something like this Comcode…

Code

Welcome blah blah blah.

{+START,IF,{$EQ,{$_GET,id},245}}
<comcode for ID#245 goes here>
{+END}

Goodbye blah blah blah.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#32257
Joe
Avatar

Honoured member

Yes, but you're misunderstanding what I mean. The downloads do support thumbnails, and are only viewable when actually *viewing* the item. I'm talking about a small thumbnail next to each item listed in the category (Category index).

Ex:

-Downloads Index
–Category: Mods ← This has a thumbnail
—Item: Popup PM Notification - IPB v2.2 Thumbnail only viewable when viewing the actual item; not viewable in category-view which lists the items.
–Category: Skins
–Category: PSD's

Back to the top
 
Posted
Rating:
#32260
Joe
Avatar

Honoured member

Ok, Chris. Using the Comcode you specified above, is there a way to hide the text that is shown before that when viewing the specific page (id=245)?

I was thinking of adding all the content on the main page and have each clickable; pointing to their corresponding ID page, but when you view the page of the item, all the content you put before the Comcode on the main page is still visible.

Back to the top
 
Posted
Rating:
#32276
Avatar

Hi,

Re: Whisper
  • category thumbnails can be set by setting the "representative image" in the edit screen for the category which is to have the thumbnail.

Re: specific question

Code

{+START,IF,{$EQ,{$_GET,id},}}
Welcome blah blah blah.
{+END}

{+START,IF,{$EQ,{$_GET,id},245}}
<comcode for ID#245 goes here>
{+END}

{+START,IF,{$EQ,{$_GET,id},}}
{+END}
Goodbye blah blah blah.

This only shows the message if that ID is equal to blank. Any non-passed parameter will be treated as being blank.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#32285
Joe
Avatar

Honoured member

Thanks Chris. Everything seems to be working pefectly, however, my Comcode page is very messy! Perhaps a more user-friendly way of doing this in future versions?

The thing is, you cannot have linebreaks within that Comcode, or else when viewing the last ID page listed in your Comcode Page, you'll have a lot of line breaks and the content in that Comcode appears further down the page. I've made a work-around this by using several <br />'s wrapped in HTML tags. I may be doing it the hard way, but it works, however, it's a little messy. :P

Thanks again Chris. :)

Back to the top
 
Posted
Rating:
#32302
Joe
Avatar

Honoured member

Chris - One final question regarding creating tags.

I've looked at the tutorial for creating custom comcode tags, however, I'm still a bit confused. Say if I were to choose to make that Comcode into an ID tag…how would I do this?

Obviously, for this tag, you would need to specify an ID number making the tag similar to the URL tag, IMG tag, etc.

Ex:

Code

[ID="245"]{content}[/ID]

To clear up the question a bit, how would I enable the ability to specify an ID number in the tag?


Last edit: by Joe

Back to the top
 
Posted
Rating:
#32314
Avatar

Create the Custom Comcode tag named 'ID', with a Parameters of 'param='.
Set the substitution to be:

Code

{+START,IF,{$EQ,{$_GET,id},{param}}}
{content}
{+END}
Also set it as a 'Block tag' so that you can put each one it's own line.

Please note though I haven't tested this.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#32319
Joe
Avatar

Honoured member

Ehh, it doesn't work I'm afraid. When viewing the main comcode page (without any parameters in the URL), I can see everything, including what's supposed to only show on the ID pages and I can see the ID tags. Same thing for when there's an ID parameter in the URL, I see the original comcode page.

Back to the top
 
Posted
Rating:
#32402
Avatar

Hi,

It's working ok on my own setup. Are you sure you named the tag 'id'?

Here's my test Comcode:

Code

[test="1"]blah 1[/test]
[test="2"]blah 2[/test]
[test="3"]blah 3[/test]

And I've attached a screenshot of my tag definition screen:


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#32427
Joe
Avatar

Honoured member

Ok, I don't know how to explain this - but at first the ID tags didn't work, so I created a TEST tag, which worked. I created another tag, PAGEID, which worked also. Strange thing is, before I created the PAGEID tag, the ID tag still didn't work, but after I created the PAGEID tag and edited my testing Comcode page with the tag, all three tags were working (ID, PAGEID, TEST).

I checked the settings in the ID tag before I created any additional tags, and they matched your settings. I don't know what exactly happened, but after I created the last tag and began to use it, the ID tag started to work.


I'm going to delete the TEST tag and keep the others, but only use the ID tag. I don't want to delete the PAGEID tag because it's almost as if the ID tag requires the PAGEID tag to exist. o_O

Back to the top
 
Posted
Rating:
#32428
Avatar

Aha.
If you put in references to your tag before it existed, the Comcode would have been parsed and cached, so it would not have been picked up.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#32445
Joe
Avatar

Honoured member

Sorry Chris, one final thing:

When a page is specified that doesn't exist, it just shows a blank page. Is there a way I can give users a "page not found" error when they view these non-existing pages?

This is optional, so take your time to respond if you'd like - I would just *prefer* that users are given a not found error. :)

Back to the top
 
Posted
Rating:
#32451
Avatar

This is what's happening. Admin's get a "Add new page" button and error, whilst others just get an error.

Perhaps something else is causing a blank page?


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#32456
Joe
Avatar

Honoured member

Let me clear up my question a bit:

When users (members and staff) specify an ID within a page that doesn't exist, they are given a blank page. How do I specify an error stating the page doesn't exist?

Back to the top
 
Posted
Rating:
#32459
Avatar

Oh, I see. I think this would be a bit too fiddly to be worth it. You could probably:
  • split the references to your custom Comcode tag into a different Comcode page (e.g. a page named subpage)
  • include that page into the main Comcode page, using the 'include' Comcode tag.
  • use some Tempcode to see if what would be included was blank, and output a message accordingly…

Code

[include="_SEARCH"]subpage[/include]
{+START,IF_EMPTY,{$INCLUDE,_SEARCH:subpage}}
<p>
   Page not found.
</p>
{+END}

(this is untested)


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#32906
Avatar

You're diving so much in code at this point anyway you might want to consider making something in PHP. There would be a lot of overhead, but you might be able to have these entires in a special catalogue (part of ocP already) and then build your own little script that parses and shows them. It'd be a lot cleaner.

Back to the top
 
Posted
Rating:
#32931
Joe
Avatar

Honoured member

You have a point, but unfortunately, I couldn't program if my life depended on it. Hehe. :P

Back to the top
 
Posted
Rating:
#32957
Avatar

Community saint

Yes its a lot of work. I my self and having fun taking a PHP course and finding there are things I did not know.
Also find parts of it boring as they are things I know.

I run http://otakuplayground.com and am hopping to make themes and other things for ocportal even though I no longer use it for otakuplayground.com I still love it and feel it could go far with the right help. It needs themes and needs people to advertise for it.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: